/******************************************************************************************************************************
 * ****************************************************************************************************************************
 */
/***-----全局变量--------：**/
/***-----用来缓存页面中所有已加载ztree对象和元素------*****/
var _ztreemap={};
/***-----记录光标脱离相关元素-----------****/
var _ztreefocs=".newztreebg,.newztreebg *";

/***-----初始化动态加载ztree所依赖css文件/js文件--------****/
$("#ztree1-css-link").remove();
$("#ztree2-css-link").remove();
$("<link id='ztree1-css-link'>").attr({rel:"stylesheet",type:"text/css",href:"/static/plugins/ztree/zTreeStyle/zTreeStyle.css"}).appendTo("head");
$("<link id='ztree2-css-link'>").attr({rel:"stylesheet",type:"text/css",href:"/static/plugins/ztree/zTreeStyle/newzTree.css"}).appendTo("head");
$("#ztree1-script-link").remove();
$("#ztree2-script-link").remove();
$("<script id='ztree1-script-link'>").attr({type:"text/javascript",src:"/static/plugins/ztree/jquery.ztree.core.js"}).appendTo("head");
$("<script id='ztree2-script-link'>").attr({type:"text/javascript",src:"/static/plugins/ztree/jquery.ztree.excheck.js"}).appendTo("head");
$("<script id='ztree3-script-link'>").attr({type:"text/javascript",src:"/static/plugins/ztree/jquery.ztree.exhide.js"}).appendTo("head");
/**********************************|
 * 1.隐藏
 * @param t_this
 */
function closeZtree(t_this){
	$(t_this).parent().parent(".newztreebg").hide();
}



/**********************************|
 * 2.光标脱离则关闭
 */
$(document).click(function(e){
	e=window.event||e;
	obj=e.target||e.srcElement;
	if(!$(obj).is(_ztreefocs)){
		$(".newztreebg").hide();
	}
	
	
});
/**********************************|
 * 3.初始化已选择的节点状态
 * @returns
 */
function initCheckedNode(_ztree,dms){
//	console.log(_ztree);
	if(dms!=undefined){
		var dmarr=dms.split(",");
		var dmmap={};
		$.each(dmarr,function(i,dm){
			dmmap[dm]=dm;
		});
		//筛选id为dm中存在的节点
		var treeObj = _ztree.getNodesByFilter(function(node){
			if(dmmap[node.id]!=undefined){
				return true;
			}else{
				return false;
			}
		});
		//console.log(treeObj);
		$.each(treeObj,function(i,obj){
			obj.checked=true;
			_ztree.checkNode(obj,true,true);
		});
	}
	
}
/**********************************|
 * 4.生成ztree唯一标识，防止重复
 * @returns
 */
function createZtreeKey(){
	var s=[];
	var hexDigits="0123456789abcdef";
	for(var i=0;i<36;i++){
		s[i]=hexDigits.substr(Math.floor(Math.random()*0x10), 1);
	}
	s[14]="4";
	s[19]=hexDigits.substr((s[19]&0x3)|0x8,1);
	s[8]=s[13]=s[18]=s[23]="";
	var key=s.join("");
	return key;
}

/**
 * 
 * @param zTreeId ztree对象的id,不需要#
 * @param searchField 输入框选择器
 * @param isHighLight 是否高亮,默认高亮,传入false禁用
 * @param isExpand 是否展开,默认合拢,传入true展开
 * @returns
 */ 
 function fuzzySearch(zTreeId, searchField, isHighLight, isExpand){
    var zTreeObj = $.fn.zTree.getZTreeObj(zTreeId);//获取树对象
    if(!zTreeObj){
        alter("获取树对象失败");
    }
    var nameKey = zTreeObj.setting.data.key.name; //获取name属性的key
    isHighLight = isHighLight===false?false:true;//除直接输入false的情况外,都默认为高亮
    isExpand = isExpand?true:false;
    zTreeObj.setting.view.nameIsHTML = isHighLight;//允许在节点名称中使用html,用于处理高亮
    
    var metaChar = '[\\[\\]\\\\\^\\$\\.\\|\\?\\*\\+\\(\\)]'; //js正则表达式元字符集
    var rexMeta = new RegExp(metaChar, 'gi');//匹配元字符的正则表达式
    
    // 过滤ztree显示数据
    function ztreeFilter(zTreeObj,_keywords,callBackFunc) {
        if(!_keywords){
            _keywords =''; //如果为空，赋值空字符串
        }
        
        // 查找符合条件的叶子节点
        function filterFunc(node) {
            if(node && node.oldname && node.oldname.length>0){
                node[nameKey] = node.oldname; //如果存在原始名称则恢复原始名称
            }
            zTreeObj.updateNode(node); //更新节点让之前对节点所做的修改生效
            if (_keywords.length == 0) { 
                //如果关键字为空,返回true,表示每个节点都显示
                zTreeObj.showNode(node);
                zTreeObj.expandNode(node,isExpand); //关键字为空时是否展开节点
                return true;
            }
            //节点名称和关键字都用toLowerCase()做小写处理
            if (node[nameKey] && node[nameKey].toLowerCase().indexOf(_keywords.toLowerCase())!=-1) {
                if(isHighLight){ //如果高亮，对文字进行高亮处理
                    //创建一个新变量newKeywords,不影响_keywords在下一个节点使用
                    //对_keywords中的元字符进行处理,否则无法在replace中使用RegExp
                    var newKeywords = _keywords.replace(rexMeta,function(matchStr){
                        //对元字符做转义处理
                        return '\\' + matchStr;
                        
                    });
                    node.oldname = node[nameKey]; //缓存原有名称用于恢复
                    //为处理过元字符的_keywords创建正则表达式,全局且不分大小写
                    var rexGlobal = new RegExp(newKeywords, 'gi');//'g'代表全局匹配,'i'代表不区分大小写
                    //无法直接使用replace(/substr/g,replacement)方法,所以使用RegExp
                    node[nameKey] = node.oldname.replace(rexGlobal, function(originalText){
                        //将所有匹配的子串加上高亮效果
                        var highLightText =originalText
                        return  highLightText;                  
                    });
                    zTreeObj.updateNode(node); //update让更名和高亮生效
                }
                zTreeObj.showNode(node);//显示符合条件的节点
                return true; //带有关键字的节点不隐藏
            }
            
            zTreeObj.hideNode(node); // 隐藏不符合要求的节点
            return false; //不符合返回false
        }
        var nodesShow = zTreeObj.getNodesByFilter(filterFunc); //获取匹配关键字的节点
        processShowNodes(nodesShow, _keywords);//对获取的节点进行二次处理
    }
    
    /**
     * 对符合条件的节点做二次处理
     */
    function processShowNodes(nodesShow,_keywords){
        if(nodesShow && nodesShow.length>0){
            //关键字不为空时对关键字节点的祖先节点进行二次处理
            if(_keywords.length>0){ 
                $.each(nodesShow, function(n,obj){
                    var pathOfOne = obj.getPath();//向上追溯,获取节点的所有祖先节点(包括自己)
                    if(pathOfOne && pathOfOne.length>0){
                        // i < pathOfOne.length-1, 对节点本身不再操作
                        for(var i=0;i<pathOfOne.length-1;i++){
                            zTreeObj.showNode(pathOfOne[i]); //显示节点
                            zTreeObj.expandNode(pathOfOne[i],true); //展开节点
                        }
                    }
                });             
            }else{ //关键字为空则显示所有节点, 此时展开根节点
                var rootNodes = zTreeObj.getNodesByParam('level','0');//获得所有根节点
                $.each(rootNodes,function(n,obj){
                    zTreeObj.expandNode(obj,true); //展开所有根节点
                });
            }
        }
    }
    
    //监听关键字input输入框文字变化事件
    $(searchField).bind('input propertychange', function() {
        var _keywords = $(this).val();
        searchNodeLazy(_keywords); //调用延时处理
    });

    var timeoutId = null;
    // 有输入后定时执行一次，如果上次的输入还没有被执行，那么就取消上一次的执行
    function searchNodeLazy(_keywords) {
        if (timeoutId) { //如果不为空,结束任务
            clearTimeout(timeoutId);
        }
        timeoutId = setTimeout(function() {
            ztreeFilter(zTreeObj,_keywords);    //延时执行筛选方法
            $(searchField).focus();//输入框重新获取焦点
        }, 500);
    }
}

/***加载组织机构树多选****/
 function showTree_checboxall(ssjgdm,mc_id,dm_id,selectid,zNodes){
	    var NodesCont=zNodes;
	    $(".newztreebg").hide();
	    _ztreefocs+=",#"+mc_id;
	    var _ztree_id="ZTREE_"+mc_id;
	    var _ztree=_ztreemap[_ztree_id];
	    if(selectid=='' || selectid==null){
	    	selectid = $("#add_xqpcsdm").val();
	    }
	    if(_ztree==undefined||$("#"+_ztree_id).length<1){//第一次加载
	        //ztree设置
	        var setting = {
	            view:{
	                showIcon:false //不显示节点图标
	            },
	            check : {
					enable : true,  //全部可以选中
					chkboxType:{"Y":"s","N":"ps"},//父子关联
					chkStyle:"radio",
					radioType:'all',
					chkDisabledInherit: false
				},
	            callback : {
	                onCheck:function(event, treeId, treeNode){
	                    var node_id=treeNode.id;
	                    var node_name=treeNode.name;
	                    var treeObj = $.fn.zTree.getZTreeObj(_ztree_id);
	                    var nodes = treeObj.getCheckedNodes(true);
	                    var dmarr=new Array();
	                    var mcarr=new Array();
	                    $.each(nodes,function(i,obj){
	                       // if(!obj.isParent){
	                            dmarr.push(obj.id);
	                            mcarr.push(obj.name);
	                       // }
	                    });
	                    $("#"+dm_id).val(dmarr.join(","));
	                    $("#"+mc_id).val(mcarr.join(","));
	                }
	            },
	            data : {
	                simpleData : {
	                    enable : true
	                }
	            }
	        };
	        var zNodes =new Array();

	        //封装参数
	        var params=new Object();
	        params.parId = selectid;
	        params.zzjgdm = $("#add_xqpcsdm").val();
	        //params.ssjgdm=ssjgdm;
	        //发送请求，获取数据
	        $.ajax({
	            url:"/tools/getZzjgTreeDic",
	            type: "GET",
	            data: {
	            	param:JSON.stringify(params)
	            },
	            async:false,
	            success: function (result) {
	                	_ztreemap[_ztree_id]=undefined;
	                    var list=result.data;
	                    if(list!=undefined&&list.length>0){
	                        $.each(list,function(i,obj){
	                            var mc=obj.zzjgmc;
	                            var fbm=obj.ssjgdm;
	                            var isopen = false;
	                            var bm=obj.zzjgdm;
	                            var node = {
	                                id : bm,
	                                pId : fbm,
	                                name : mc,
	                                open : false
	                            };
	                            zNodes.push(node);
	                        });
	                    }

	            },
	            error: function (XmlHttpRequest, textStatus, errorThrown) {
	                console("系统异常，加载菜单出现异常！");
	            }
	        });
	        //点击选中事件
	        //初始化ztree树节点
	        var _ztree_key=createZtreeKey();
	        var _ztree_htm="<div id='zkbg-"+_ztree_key+"' class='newztreebg'>";
	        _ztree_htm+="		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
	        _ztree_htm+="		<ul id='"+_ztree_id+"' class='ztree newztree c_overflow'></ul>";
	        _ztree_htm+="	</div>";
	        $("zkbg-"+_ztree_key+"").remove();
	        $("#"+mc_id).after(_ztree_htm);
	        $.fn.zTree.init($("#"+_ztree_id), setting, zNodes);
	        _ztree = $.fn.zTree.getZTreeObj(_ztree_id);
//	        _ztreemap[_ztree_id]=_ztree;
	        //初始化已选中的节点
	        initCheckedNode(_ztree,$("#"+dm_id).val());
	        $("#"+_ztree_id).parent().show();
	    }else{
	        $("#"+_ztree_id).parent().show();
	    }
	}
 /***加载组织机构树多选****/
 function showTree_gxdw(ssjgdm,mc_id,dm_id,selectid,zNodes){
	 	if(isBjdwVal!=undefined){
	 		isBjdwVal = '';
	 	}
	    var NodesCont=zNodes;
	    $(".newztreebg").hide();
	    _ztreefocs+=",#"+mc_id;
	    var _ztree_id="ZTREE_"+mc_id;
	    var _ztree=_ztreemap[_ztree_id];
	    if(selectid=='' || selectid==null){
	    	selectid = $("#add_xqpcsdm").val();
	    }
	    if(_ztree==undefined||$("#"+_ztree_id).length<1){//第一次加载
	        //ztree设置
	        var setting = {
	            view:{
	                showIcon:false //不显示节点图标
	            },
	            check : {
					enable : true,  //全部可以选中
					chkboxType:{"Y":"s","N":"ps"},//父子关联
					chkStyle:"radio",
					radioType:'all',
					chkDisabledInherit: false
				},
	            callback : {
	                onCheck:function(event, treeId, treeNode){
	                    var node_id=treeNode.id;
	                    var node_name=treeNode.name;
	                    var treeObj = $.fn.zTree.getZTreeObj(_ztree_id);
	                    var nodes = treeObj.getCheckedNodes(true);
	                    var dmarr=new Array();
	                    var mcarr=new Array();
	                    $.each(nodes,function(i,obj){
	                       // if(!obj.isParent){
	                            dmarr.push(obj.id);
	                            mcarr.push(obj.name);
	                       // }
	                    });
	                    $("#"+dm_id).val(dmarr.join(","));
	                    $("#"+mc_id).val(mcarr.join(","));
	                }
	            },
	            data : {
	                simpleData : {
	                    enable : true
	                }
	            }
	        };
	        var zNodes =new Array();
	        //封装参数
	        var params=new Object();
	        params.parId = selectid;
	        params.zzjgdm = $("#add_xqpcsdm").val();
	        //params.ssjgdm=ssjgdm;
	        //发送请求，获取数据
	        $.ajax({
	            url:"/tools/getZzjgTreeDic",
	            type: "GET",
	            data: {
	            	param:JSON.stringify(params)
	            },
	            async:false,
	            success: function (result) {
	                	_ztreemap[_ztree_id]=undefined;
	                    var list=result.data;
	                    if(list!=undefined&&list.length>0){
	                        $.each(list,function(i,obj){
	                            var mc=obj.zzjgmc;
	                            var fbm=obj.ssjgdm;
	                            var isopen = false;
	                            var bm=obj.zzjgdm;
	                            var node = {
	                                id : bm,
	                                pId : fbm,
	                                name : mc,
	                                open : false
	                            };
	                            zNodes.push(node);
	                        });
	                    }

	            },
	            error: function (XmlHttpRequest, textStatus, errorThrown) {
	                console("系统异常，加载菜单出现异常！");
	            }
	        });
	        //点击选中事件
	        //初始化ztree树节点
	        var _ztree_key=createZtreeKey();
	        var _ztree_htm="<div id='zkbg-"+_ztree_key+"' class='newztreebg'>";
	        _ztree_htm+="		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
	        _ztree_htm+="		<ul id='"+_ztree_id+"' class='ztree newztree c_overflow'></ul>";
	        _ztree_htm+="	</div>";
	        $("zkbg-"+_ztree_key+"").remove();
	        $("#"+mc_id).after(_ztree_htm);
	        $.fn.zTree.init($("#"+_ztree_id), setting, zNodes);
	        _ztree = $.fn.zTree.getZTreeObj(_ztree_id);
//	        _ztreemap[_ztree_id]=_ztree;
	        //初始化已选中的节点
	        initCheckedNode(_ztree,$("#"+dm_id).val());
	        $("#"+_ztree_id).parent().show();
	    }else{
	        $("#"+_ztree_id).parent().show();
	    }
	}
/**
 * 加载组织机构选择树 （单选）
 * @param mc_id
 * @param dm_id
 * @param selectid 不为空时 展开传入节点所在的级别  并选中该节点
 */
function showTree_Single(ssjgdm,mc_id,dm_id,selectid,zNodes){
    var NodesCont=zNodes;
    $(".newztreebg").hide();
    _ztreefocs+=",#"+mc_id;
    var _ztree_id="ZTREE_"+mc_id;
    var _ztree=_ztreemap[_ztree_id];
    if(selectid=='' || selectid==null){
    	selectid = $("#gxdwdm").val();
    }
    if(_ztree==undefined||$("#"+_ztree_id).length<1){//第一次加载
        //ztree设置
        var setting = {
            view:{
                showIcon:false //不显示节点图标
            },
            check : {
                chkStyle: "radio",
                radioType: "all",
                enable : true,
                open : false
            },
            // check : {
            //     enable: true,  //全部可以选中
            //     chkboxType: {"Y": "", "N": ""},//父子关联
            //     chkDisabledInherit: false
            // },
            callback : {
                onCheck:function(event, treeId, treeNode){
                    var node_id=treeNode.id;
                    var node_name=treeNode.name;
                    var treeObj = $.fn.zTree.getZTreeObj(_ztree_id);
                    var nodes = treeObj.getCheckedNodes(true);
                    var dmarr=new Array();
                    var mcarr=new Array();
                    $.each(nodes,function(i,obj){
                        // if(!obj.isParent){
                            dmarr.push(obj.id);
                            mcarr.push(obj.name);
                        // }
                    });
                    $("#"+dm_id).val(dmarr.join(","));
                    $("#"+mc_id).val(mcarr.join(","));
                }
            },
            data : {
                simpleData : {
                    enable : true
                }
            }
        };
        var zNodes =new Array();

        //封装参数
        var params=new Object();
        params.parId = selectid;
        //params.ssjgdm=ssjgdm;
        params.zzjgdm = '370000000000';
        //发送请求，获取数据
        $.ajax({
            url: "/tools/getZzjgTreeDic",
            type: "GET",
            data: params,
            async:false,
            success: function (result) {
                var success=result.success;
                if(success==true){
                	_ztreemap[_ztree_id]=undefined;
                    var list=result.list;
                    if(list!=undefined&&list.length>0){
                        $.each(list,function(i,obj){
                            var mc=obj.zzjgmc;
                            var fbm=obj.ssjgdm;
                            var isopen = false;
                            var bm=obj.zzjgdm;
                            var node = {
                                id : bm,
                                pId : fbm,
                                name : mc,
                                open : false
                            };
                            zNodes.push(node);
                        });
                    }

                }
            },
            error: function (XmlHttpRequest, textStatus, errorThrown) {
                console("系统异常，加载菜单出现异常！");
            }
        });
        //点击选中事件
        //初始化ztree树节点
        var _ztree_key=createZtreeKey();
        var _ztree_htm="<div id='zkbg-"+_ztree_key+"' class='newztreebg'>";
        _ztree_htm+="		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
        _ztree_htm+="		<ul id='"+_ztree_id+"' class='ztree newztree c_overflow'></ul>";
        _ztree_htm+="	</div>";
        $("zkbg-"+_ztree_key+"").remove();
        $("#"+mc_id).after(_ztree_htm);
        $.fn.zTree.init($("#"+_ztree_id), setting, zNodes);
        _ztree = $.fn.zTree.getZTreeObj(_ztree_id);
//        _ztreemap[_ztree_id]=_ztree;
        //初始化已选中的节点
        initCheckedNode(_ztree,$("#"+dm_id).val());
        $("#"+_ztree_id).parent().show();
    }else{
        $("#"+_ztree_id).parent().show();
    }
   //  //选中传入的id
   // if(selectid!=''){
   // 	var selectnode = _ztree.getNodeByParam("id",selectid);
   // 	var parentnode = selectnode.getParentNode();
   // 	if(!parentnode.open){
   // 		_ztree.expandNode(parentnode,true,false);
	// 	}
   //     initCheckedNode(_ztree,selectid);
   // }
}

function showTree_Single_Bympdz(ssjgdm,mc_id,dm_id,selectid,zNodes){
    var NodesCont=zNodes;
    $(".newztreebg").hide();
    _ztreefocs+=",#"+mc_id;
    var _ztree_id="ZTREE_"+mc_id;
    var _ztree=_ztreemap[_ztree_id];
    if(selectid=='' || selectid==null){
    	selectid = $("#add_mpdzdm").val();
    }
    if(_ztree==undefined||$("#"+_ztree_id).length<1){//第一次加载
        //ztree设置
        var setting = {
            view:{
                showIcon:false //不显示节点图标
            },
            check : {
                chkStyle: "radio",
                radioType: "all",
                enable : true,
                open : false
            },
            // check : {
            //     enable: true,  //全部可以选中
            //     chkboxType: {"Y": "", "N": ""},//父子关联
            //     chkDisabledInherit: false
            // },
            callback : {
                onCheck:function(event, treeId, treeNode){
                    var node_id=treeNode.id;
                    var node_name=treeNode.name;
                    var treeObj = $.fn.zTree.getZTreeObj(_ztree_id);
                    var nodes = treeObj.getCheckedNodes(true);
                    var dmarr=new Array();
                    var mcarr=new Array();
                    $.each(nodes,function(i,obj){
                        // if(!obj.isParent){
                            dmarr.push(obj.id);
                            mcarr.push(obj.name);
                        // }
                    });
                    $("#"+dm_id).val(dmarr.join(","));
                    $("#"+mc_id).val(mcarr.join(","));
                }
            },
            data : {
                simpleData : {
                    enable : true
                }
            }
        };
        var zNodes =new Array();

        //封装参数
        var params=new Object();
        params.parId = selectid;
        //params.ssjgdm=ssjgdm;
        //发送请求，获取数据
        $.ajax({
            url: path+"/dict/getCustomZzjgZdListByFbmAndBm",
            type: "POST",
            data: params,
            async:false,
            success: function (result) {
                var success=result.success;
                if(success==true){
                	_ztreemap[_ztree_id]=undefined;
                    var list=result.list;
                    if(list!=undefined&&list.length>0){
                        $.each(list,function(i,obj){
                            var mc=obj.zzjgmc;
                            var fbm=obj.ssjgdm;
                            var isopen = false;
                            var bm=obj.zzjgdm;
                            var node = {
                                id : bm,
                                pId : fbm,
                                name : mc,
                                open : false
                            };
                            zNodes.push(node);
                        });
                    }

                }
            },
            error: function (XmlHttpRequest, textStatus, errorThrown) {
                console("系统异常，加载菜单出现异常！");
            }
        });
        //点击选中事件
        //初始化ztree树节点
        var _ztree_key=createZtreeKey();
        var _ztree_htm="<div id='zkbg-"+_ztree_key+"' class='newztreebg'>";
        _ztree_htm+="		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
        _ztree_htm+="		<ul id='"+_ztree_id+"' class='ztree newztree c_overflow'></ul>";
        _ztree_htm+="	</div>";
        $("zkbg-"+_ztree_key+"").remove();
        $("#"+mc_id).after(_ztree_htm);
        $.fn.zTree.init($("#"+_ztree_id), setting, zNodes);
        _ztree = $.fn.zTree.getZTreeObj(_ztree_id);
//        _ztreemap[_ztree_id]=_ztree;
        //初始化已选中的节点
        initCheckedNode(_ztree,$("#"+dm_id).val());
        $("#"+_ztree_id).parent().show();
    }else{
        $("#"+_ztree_id).parent().show();
    }
   //  //选中传入的id
   // if(selectid!=''){
   // 	var selectnode = _ztree.getNodeByParam("id",selectid);
   // 	var parentnode = selectnode.getParentNode();
   // 	if(!parentnode.open){
   // 		_ztree.expandNode(parentnode,true,false);
	// 	}
   //     initCheckedNode(_ztree,selectid);
   // }
}

/********************************************************************************************************
 ********************************************************************************************************
 * 加载选择树(多选/通用)
 * ***************       准驾车型、民族             ******************
 * @param mc_id
 * @param dm_id
 */
function showTree_tyzd(zdlx,mc_id,dm_id){
	$(".newztreebg").hide();
	_ztreefocs+=",#"+mc_id;
	var _ztree_id="ZTREE_"+mc_id;
	var _ztree=_ztreemap[_ztree_id];
	if(_ztree==undefined||$("#"+_ztree_id).length<1){//第一次加载
		//ztree设置
		var setting = {
			view:{
				showIcon:false //不显示节点图标
			},
			check : {
				enable : true,  //全部可以选中
				chkboxType:{"Y":"ps","N":"ps"},//父子关联
				chkDisabledInherit: false
			},
			callback : {
				onCheck:function(event, treeId, treeNode){
					//console.log(treeNode.checked);
					var node_id=treeNode.id;
					var node_name=treeNode.name;
					var treeObj = $.fn.zTree.getZTreeObj(_ztree_id);
					var nodes = treeObj.getCheckedNodes(true);
					var dmarr=new Array();
					var mcarr=new Array();
					$.each(nodes,function(i,obj){
						if(obj.level>0){
							dmarr.push(obj.id);
							mcarr.push(obj.name);
						}
					});
					$("#"+dm_id).val(dmarr.join(","));
					$("#"+mc_id).val(mcarr.join(","));
				}
			},
			data : {
				simpleData : {
					enable : true
				}
			}
		};
		var zNodes =new Array();
		//封装参数
		var params=new Object();
		params.fbm=zdlx;
		//发送请求，获取数据
		$.ajax({
		    url: "/dict/getTyZdList",
		    type: "GET",
		    data: {
		    	fbm:zdlx
		    },
		    async:false,
		    dataType:'json',
		    success: function (result) {
		        var success=result.success;
		        if(success==true){
		        	var list=result.list;
		        	var node = {
							id : zdlx,
							pId : "",
							name : "全选",
							open : true
					};
		        	zNodes.push(node);
		        	if(list!=undefined&&list.length>0){
		        		$.each(list,function(i,obj){
		        			var mc=obj.mc;
		        			var fbm=obj.fbm;
		        			var bm=obj.bm;
							var node = {
								id : bm,
								pId : fbm,
								name : mc,
								open : true
							};
							zNodes.push(node);
		        		});
		        	}
		        }
		    },
		    error: function (XmlHttpRequest, textStatus, errorThrown) {
		       console.log("系统异常，加载民族菜单出现异常！");
		    }
		});
		//点击选中事件
		//初始化ztree树节点
		var _ztree_key=createZtreeKey();
		var _ztree_htm="<div id='zkbg-"+_ztree_key+"' class='newztreebg'>";
		_ztree_htm+="		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
		_ztree_htm+="		<ul id='"+_ztree_id+"' class='ztree newztree c_overflow'></ul>";
		_ztree_htm+="	</div>";
		$("zkbg-"+_ztree_key+"").remove();
		$("#"+mc_id).after(_ztree_htm);
		$.fn.zTree.init($("#"+_ztree_id), setting, zNodes);
		_ztree = $.fn.zTree.getZTreeObj(_ztree_id);
		_ztreemap[_ztree_id]=_ztree;
		//初始化已选中的节点
		initCheckedNode(_ztree,$("#"+dm_id).val());
		$("#"+_ztree_id).parent().show();
	}else{
		$("#"+_ztree_id).parent().show();
	}
}
/********************************************************************************************************
 ********************************************************************************************************
 * 加载选择树(多选/自定义bm)
 * @param mc_id
 * @param dm_id
 */
function showTree_customzd(zdlx,mc_id,dm_id,bms){
	$(".newztreebg").hide();
	_ztreefocs+=",#"+mc_id;
	var _ztree_id="ZTREE_"+mc_id;
	var _ztree=_ztreemap[_ztree_id];
	console.log($("#"+_ztree_id).length);
	if(_ztree==undefined||$("#"+_ztree_id).length<1){//第一次加载
		//ztree设置
		var setting = {
			view:{
				showIcon:false //不显示节点图标
			},
			check : {
				enable : true,  //全部可以选中
				chkboxType:{"Y":"ps","N":"ps"},//父子关联
				chkDisabledInherit: false
			},
			callback : {
				onCheck:function(event, treeId, treeNode){
					//console.log(treeNode.checked);
					var node_id=treeNode.id;
					var node_name=treeNode.name;
					var treeObj = $.fn.zTree.getZTreeObj(_ztree_id);
					var nodes = treeObj.getCheckedNodes(true);
					var dmarr=new Array();
					var mcarr=new Array();
					$.each(nodes,function(i,obj){
						if(obj.level>0){
							dmarr.push(obj.id);
							mcarr.push(obj.name);
						}
					});
					$("#"+dm_id).val(dmarr.join(","));
					$("#"+mc_id).val(mcarr.join(","));
				}
			},
			data : {
				simpleData : {
					enable : true
				}
			}
		};
		var zNodes =new Array();
		//封装参数
		var params=new Object();
		params.fbm=zdlx;
		params.bm=bms;
		//发送请求，获取数据
		$.ajax({
		    url: path+"/dict/getCustomZdList",
		    type: "POST",
		    data: params,
		    async:false,
		    success: function (result) {
		        var success=result.success;
		        if(success==true){
		        	var list=result.list;
		        	var node = {
							id : zdlx,
							pId : "",
							name : "全选",
							open : true
					};
		        	zNodes.push(node);
		        	if(list!=undefined&&list.length>0){
		        		$.each(list,function(i,obj){
		        			var mc=obj.mc;
		        			var fbm=obj.fbm;
		        			var bm=obj.bm;
							var node = {
								id : bm,
								pId : fbm,
								name : mc,
								open : true
							};
							zNodes.push(node);
		        		});
		        	}
		        }
		    },
		    error: function (XmlHttpRequest, textStatus, errorThrown) {
		       console.log("系统异常，加载民族菜单出现异常！");
		    }
		});
		//点击选中事件
		//初始化ztree树节点
		var _ztree_key=createZtreeKey();
		var _ztree_htm="<div id='zkbg-"+_ztree_key+"' class='newztreebg'>";
		_ztree_htm+="		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
		_ztree_htm+="		<ul id='"+_ztree_id+"' class='ztree newztree c_overflow'></ul>";
		_ztree_htm+="	</div>";
		$("zkbg-"+_ztree_key+"").remove();
		$("#"+mc_id).after(_ztree_htm);
		$.fn.zTree.init($("#"+_ztree_id), setting, zNodes);
		_ztree = $.fn.zTree.getZTreeObj(_ztree_id);
		_ztreemap[_ztree_id]=_ztree;
		//初始化已选中的节点
		initCheckedNode(_ztree,$("#"+dm_id).val());
		$("#"+_ztree_id).parent().show();
	}else{
		$("#"+_ztree_id).parent().show();
	}
}

/********************************************************************************************************
 ********************************************************************************************************
 * 加载户籍地选择树(多选/通用:包含省、市、区县)
 * @param mc_id
 * @param dm_id
 */
function showTree_hjd(mc_id,dm_id){
	$(".newztreebg").hide();
	_ztreefocs+=",#"+mc_id;
	var _ztree_id="ZTREE_"+mc_id;
	var _ztree=_ztreemap[_ztree_id];
	if(_ztree==undefined||$("#"+_ztree_id).length<1){//第一次加载
		//ztree设置
		var setting = {
			view:{
				showIcon:false //不显示节点图标
			},
			check : {
				enable : true,  //全部可以选中
				chkboxType:{"Y":"ps","N":"ps"},//父子关联
				chkDisabledInherit: false
			},
			callback : {
				onCheck:function(event, treeId, treeNode){
					//console.log(treeNode.checked);
					var node_id=treeNode.id;
					var node_name=treeNode.name;
					var treeObj = $.fn.zTree.getZTreeObj(_ztree_id);
					var nodes = treeObj.getCheckedNodes(true);
					var dmarr=new Array();
					var mcarr=new Array();
					$.each(nodes,function(i,obj){
						if(!obj.isParent){
							dmarr.push(obj.id);
							mcarr.push(obj.name);
						}
					});
					$("#"+dm_id).val(dmarr.join(","));
					$("#"+mc_id).val(mcarr.join(","));
				}
			},
			data : {
				simpleData : {
					enable : true
				}
			}
		};
		var zNodes =new Array();
		//封装参数
		var params=new Object();
		//发送请求，获取数据
		$.ajax({
		    url: path+"/dict/getXzqhHjdZdList",
		    type: "POST",
		    data: params,
		    async:false,
		    success: function (result) {
		        var success=result.success;
		        if(success==true){
		        	var list=result.list;
		        	if(list!=undefined&&list.length>0){
		        		$.each(list,function(i,obj){
		        			var mc=obj.mc;
		        			var fdm=obj.fdm;
		        			var dm=obj.dm;
		        			var level=obj.level;
		        			var isopen=false;
		        			if(parseInt(level)<1){
		        				isopen=true;
		        			}
							var node = {
								id : dm,
								pId : fdm,
								name : mc,
								open : isopen
							};
							zNodes.push(node);
		        		});
		        	}
		        }
		    },
		    error: function (XmlHttpRequest, textStatus, errorThrown) {
		       console.log("系统异常，加载菜单出现异常！");
		    }
		});
		//点击选中事件
		//初始化ztree树节点
		var _ztree_key=createZtreeKey();
		var _ztree_htm="<div id='zkbg-"+_ztree_key+"' class='newztreebg'>";
		_ztree_htm+="		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
		_ztree_htm+="		<ul id='"+_ztree_id+"' class='ztree newztree c_overflow'></ul>";
		_ztree_htm+="	</div>";
		$("zkbg-"+_ztree_key+"").remove();
		$("#"+mc_id).after(_ztree_htm);
		$.fn.zTree.init($("#"+_ztree_id), setting, zNodes);
		_ztree = $.fn.zTree.getZTreeObj(_ztree_id);
		_ztreemap[_ztree_id]=_ztree;
		//初始化已选中的节点
		initCheckedNode(_ztree,$("#"+dm_id).val());
		$("#"+_ztree_id).parent().show();
	}else{
		$("#"+_ztree_id).parent().show();
	}
}
/********************************************************************************************************
 ********************************************************************************************************
 * 加载户籍地选择树(单选/通用:包含省、市、区县)
 * @param mc_id
 * @param dm_id
 */
function showTree_hjd_radio(mc_id,dm_id){
	$(".newztreebg").hide();
	_ztreefocs+=",#"+mc_id;
	var _ztree_id="ZTREE_"+mc_id;
	var _ztree=_ztreemap[_ztree_id];
	if(_ztree==undefined||$("#"+_ztree_id).length<1){//第一次加载
		//ztree设置
		var setting = {
			view:{
				showIcon:false //不显示节点图标
			},
            check : {
                chkStyle: "radio",
                radioType: "all",
                enable : true,
                open : false
            },
			callback : {
				onCheck:function(event, treeId, treeNode){
					//console.log(treeNode.checked);
					var node_id=treeNode.id;
					var node_name=treeNode.name;
					var treeObj = $.fn.zTree.getZTreeObj(_ztree_id);
					var nodes = treeObj.getCheckedNodes(true);
					var dmarr=new Array();
					var mcarr=new Array();
					$.each(nodes,function(i,obj){
							dmarr.push(obj.id);
							mcarr.push(obj.name);
					});
					$("#"+dm_id).val(dmarr.join(","));
					$("#"+mc_id).val(mcarr.join(","));
				}
			},
			data : {
				simpleData : {
					enable : true
				}
			}
		};
		var zNodes =new Array();
		//封装参数
		var params=new Object();
		params.zzjgdm = '370000000000';
		//发送请求，获取数据
		$.ajax({
		    url: "/tools/getXzqhHjdZdList",
		    type: "GET",
		    data:{
		    	param : JSON.stringify(params)
		    },
		    async:false,
		    success: function (result) {
		    	var list=result.data;
		        if(list!=undefined&&list.length>0){
		        	$.each(list,function(i,obj){
		        		var mc=obj.mc;
		        		var fdm=obj.fdm;
		        		var dm=obj.dm;
		        		var level=obj.level;
		        		var isopen=false;
		        		if(parseInt(level)<1){
		        			isopen=true;
		        		}
						var node = {
							id : dm,
							pId : fdm,
							name : mc,
							open : isopen
						};
						zNodes.push(node);
		        	});
		        }
		    },
		    error: function (XmlHttpRequest, textStatus, errorThrown) {
		       console.log("系统异常，加载菜单出现异常！");
		    }
		});
		//点击选中事件
		//初始化ztree树节点
		var _ztree_key=createZtreeKey();
		var _ztree_htm="<div id='zkbg-"+_ztree_key+"' class='newztreebg'>";
		_ztree_htm+="		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
		_ztree_htm+="		<ul id='"+_ztree_id+"' class='ztree newztree c_overflow'></ul>";
		_ztree_htm+="	</div>";
		$("zkbg-"+_ztree_key+"").remove();
		$("#"+mc_id).after(_ztree_htm);
		$.fn.zTree.init($("#"+_ztree_id), setting, zNodes);
		_ztree = $.fn.zTree.getZTreeObj(_ztree_id);
		_ztreemap[_ztree_id]=_ztree;
		//初始化已选中的节点
		initCheckedNode(_ztree,$("#"+dm_id).val());
		$("#"+_ztree_id).parent().show();
		fuzzySearch(_ztree_id,'#'+mc_id,null,false)
	}else{
		$("#"+_ztree_id).parent().show();
	}
}

/********************************************************************************************************
 ********************************************************************************************************
 * 加载户籍地选择树(单选/通用:包含省、市、区县)
 * @param mc_id
 * @param dm_id
 */
function showTree_hjd_single(mc_id,dm_id,zNodes){
	var NodesCont=zNodes;
    $(".newztreebg").hide();
    _ztreefocs+=",#"+mc_id;
    var _ztree_id="ZTREE_"+mc_id;
    var _ztree=_ztreemap[_ztree_id];
    if(_ztree==undefined||$("#"+_ztree_id).length<1){//第一次加载
        //ztree设置
        var setting = {
            view:{
                showIcon:false //不显示节点图标
            },
            check : {
                chkStyle: "radio",
                radioType: "all",
                enable : true,
				open : false
            },
            callback : {
                onCheck:function(event, treeId, treeNode){
                    //console.log(treeNode.checked);
                    var node_id=treeNode.id;
                    var boxid = event.currentTarget.id;
                    var node_name=treeNode.name;
                    var treeObj = $.fn.zTree.getZTreeObj(_ztree_id);
                    var nodes = treeObj.getCheckedNodes(true);
                    var dmarr=new Array();
                    var mcarr=new Array();
                    console.log(NodesCont)
                    $.each(nodes,function(i,obj){
                        if(!obj.isParent){
                            dmarr.push(obj.id);
                            var nodesParent =$('#'+boxid+' span.radio_false_part');
                            $.each(nodesParent,function(i,item){
                                mcarr.push($(item).next().attr('title'))
							})
                            mcarr.push(obj.name);
                        }
                    });
                    $("#"+dm_id).val(dmarr.join(","));
                    $("#"+mc_id).val(mcarr.join(""));
                }
            },
            data : {
                simpleData : {
                    enable : true
                }
            }
        };
        var zNodes =new Array();
        //封装参数
        var params=new Object();
        //发送请求，获取数据
        $.ajax({
            url: path+"/dict/getXzqhHjdZdList",
            type: "POST",
            data: params,
            async:false,
            success: function (result) {
                var success=result.success;
                if(success==true){
                    var list=result.list;
                    if(list!=undefined&&list.length>0){
                        $.each(list,function(i,obj){
                            var mc=obj.mc;
                            var fdm=obj.fdm;
                            var dm=obj.dm;
                            var level=obj.level;
                            var isopen=false;
                            if(parseInt(level)<1){
                                isopen=true;
                            }
                            var node = {
                                id : dm,
                                pId : fdm,
                                name : mc,
                                open : isopen
                            };
                            zNodes.push(node);
                        });
                    }
                }
            },
            error: function (XmlHttpRequest, textStatus, errorThrown) {
                console.log("系统异常，加载菜单出现异常！");
            }
        });
        //点击选中事件
        //初始化ztree树节点
        var _ztree_key=createZtreeKey();
        var _ztree_htm="<div id='zkbg-"+_ztree_key+"' class='newztreebg'>";
        _ztree_htm+="		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
        _ztree_htm+="		<ul id='"+_ztree_id+"' class='ztree newztree c_overflow'></ul>";
        _ztree_htm+="	</div>";
        $("zkbg-"+_ztree_key+"").remove();
        $("#"+mc_id).after(_ztree_htm);
        $.fn.zTree.init($("#"+_ztree_id), setting, zNodes);
        _ztree = $.fn.zTree.getZTreeObj(_ztree_id);
        _ztreemap[_ztree_id]=_ztree;
        //初始化已选中的节点
		var valid=$("#"+dm_id).val();
        initCheckedNode(_ztree,valid);
        $("#"+_ztree_id).parent().show();
    }else{
        $("#"+_ztree_id).parent().show();
    }
}


/********************************************************************************************************
 ********************************************************************************************************
 * 加载山东户籍地选择树(单选/通用:包含省、市、区县)
 * @param mc_id
 * @param dm_id
 */
function showTree_SDhjd_single(mc_id,dm_id){
	console.log(mc_id+"mc_id")
	console.log(dm_id+"dm_id")
    $(".newztreebg").hide();
    _ztreefocs+=",#"+mc_id;
    var _ztree_id="ZTREE_"+mc_id;
    var _ztree=_ztreemap[_ztree_id];
    if(_ztree==undefined||$("#"+_ztree_id).length<1){//第一次加载
        //ztree设置
        var setting = {
            view:{
                showIcon:false //不显示节点图标
            },
            check : {
                chkStyle: "radio",
                radioType: "all",
                enable : true,
				open : false
            },
            callback : {
                onCheck:function(event, treeId, treeNode){
                    //console.log(treeNode.checked);
                    var node_id=treeNode.id;
                    var node_name=treeNode.name;
                    var treeObj = $.fn.zTree.getZTreeObj(_ztree_id);
                    //获取所有选中节点
                    var nodes = treeObj.getCheckedNodes(true);
                    var dmarr=new Array();
                    var mcarr=new Array();
                    $.each(nodes,function(i,obj){
//                        if(!obj.isParent){
                    		var objId = obj.id;
                            // for(var i=0;i<2;i++) {
	            			// 	var s = objId.substring(objId.length-2, objId.length);
	            			// 	console.log(s);
	            			// 	if(s=='00')
	            			// 		objId = objId.substring(0, objId.length-2);
	            			// 	else
	            			// 		break;
	            			// }

                            dmarr.push(objId);
                            //保存拼接显示的名称
                            var namestr='';
                            //获取父节点
                            var parent = obj.getParentNode();
                            //父节点是否存在
                            if(parent){
                            	//判断祖父节点是否存在
								if(parent.getParentNode()){
									namestr += parent.getParentNode.name;
								}
                            	namestr += parent.name;
							}
                            mcarr.push(namestr+obj.name);
//                        }
                    });
                    $("#"+dm_id).val(dmarr.join(","));
                    $("#"+mc_id).val(mcarr.join(","));
                    //将选中的节点id 传递给管辖区派出所  并选择展开
//                    showTree_Single('sd_blcgqk','add_xqpcsmc','add_xqpcsdm',node_id);
                }
            },
            data : {
                simpleData : {
                    enable : true
                }
            }
        };
        var zNodes =new Array();
        //封装参数
        var params=new Object();
        //发送请求，获取数据
        $.ajax({
            url: path+"/dict/getXzqhSDHjdZdList",
            type: "POST",
            data: params,
            async:false,
            success: function (result) {
                var success=result.success;
                if(success==true){
                    var list=result.list;
                    if(list!=undefined&&list.length>0){
                        $.each(list,function(i,obj){
                            var mc=obj.mc;
                            var fdm=obj.fdm;
                            var dm=obj.dm;
                            var level=obj.level;
                            var isopen=false;
                            if(parseInt(level)<1){
                                isopen=true;
                            }
                            var node = {
                                id : dm,
                                pId : fdm,
                                name : mc,
                                open : isopen
                            };
                            zNodes.push(node);
                        });
                    }
                }
            },
            error: function (XmlHttpRequest, textStatus, errorThrown) {
                console.log("系统异常，加载菜单出现异常！");
            }
        });
        //点击选中事件
        //初始化ztree树节点
        var _ztree_key=createZtreeKey();
        var _ztree_htm="<div id='zkbg-"+_ztree_key+"' class='newztreebg'>";
        _ztree_htm+="		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
        _ztree_htm+="		<ul id='"+_ztree_id+"' class='ztree newztree c_overflow'></ul>";
        _ztree_htm+="	</div>";
        $("zkbg-"+_ztree_key+"").remove();
        $("#"+mc_id).after(_ztree_htm);
        $.fn.zTree.init($("#"+_ztree_id), setting, zNodes);
        _ztree = $.fn.zTree.getZTreeObj(_ztree_id);
        _ztreemap[_ztree_id]=_ztree;
        //初始化已选中的节点
        initCheckedNode(_ztree,$("#"+dm_id).val());
        $("#"+_ztree_id).parent().show();
    }else{
        $("#"+_ztree_id).parent().show();
    }
}

/********************************************************************************************************
 ********************************************************************************************************
 * 加载省市区县选择树(多选/通用:包含省/直辖市、新疆各地州)
 * @param mc_id
 * @param dm_id
 */
function showTree_hjd_simple(mc_id,dm_id){
	$(".newztreebg").hide();
	_ztreefocs+=",#"+mc_id;
	var _ztree_id="ZTREE_"+mc_id;
	var _ztree=_ztreemap[_ztree_id];
	if(_ztree==undefined||$("#"+_ztree_id).length<1){//第一次加载
		//ztree设置
		var setting = {
			view:{
				showIcon:false //不显示节点图标
			},
			check : {
				enable : true,  //全部可以选中
				chkboxType:{"Y":"ps","N":"ps"},//父子关联
				chkDisabledInherit: false
			},
			callback : {
				onCheck:function(event, treeId, treeNode){
					//console.log(treeNode.checked);
					var node_id=treeNode.id;
					var node_name=treeNode.name;
					var treeObj = $.fn.zTree.getZTreeObj(_ztree_id);
					var nodes = treeObj.getCheckedNodes(true);
					var dmarr=new Array();
					var mcarr=new Array();
					$.each(nodes,function(i,obj){
						if(!obj.isParent){
							dmarr.push(obj.id);
							mcarr.push(obj.name);
						}
						
					});
					$("#"+dm_id).val(dmarr.join(","));
					$("#"+mc_id).val(mcarr.join(","));
				}
			},
			data : {
				simpleData : {
					enable : true
				}
			}
		};
		var zNodes =new Array();
		//封装参数
		var params=new Object();
		//发送请求，获取数据
		$.ajax({
		    url: path+"/dict/queryHjdList",
		    type: "POST",
		    data: params,
		    async:false,
		    success: function (result) {
		        var success=result.success;
		        if(success==true){
		        	var list=result.list;
		        	if(list!=undefined&&list.length>0){
		        		var firstnode = {
								id : "1000",
								pId : "000000",
								name : "中国",
								open : false
						};
		        		zNodes.push(firstnode);
		        		$.each(list,function(i,obj){
		        			var mc=obj.mc;
		        			var dm=obj.dm;
		        			var fdm=obj.fdm;
							var node = {
								id : dm,
								pId :fdm,
								name : mc,
							};
							zNodes.push(node);
		        		});
		        	}
		        }
		    },
		    error: function (XmlHttpRequest, textStatus, errorThrown) {
		       console("系统异常，加载菜单出现异常！");
		    }
		});
		//点击选中事件
		//初始化ztree树节点
		var _ztree_key=createZtreeKey();
		var _ztree_htm="<div id='zkbg-"+_ztree_key+"' class='newztreebg'>";
		_ztree_htm+="		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
		_ztree_htm+="		<ul id='"+_ztree_id+"' class='ztree newztree c_overflow'></ul>";
		_ztree_htm+="	</div>";
		$("zkbg-"+_ztree_key+"").remove();
		$("#"+mc_id).after(_ztree_htm);
		$.fn.zTree.init($("#"+_ztree_id), setting, zNodes);
		_ztree = $.fn.zTree.getZTreeObj(_ztree_id);
		_ztreemap[_ztree_id]=_ztree;
		//初始化已选中的节点
		initCheckedNode(_ztree,$("#"+dm_id).val());
		$("#"+_ztree_id).parent().show();
	}else{
		$("#"+_ztree_id).parent().show();
	}
}
/********************************************************************************************************
 ********************************************************************************************************
 * 加载路线、出行线路选择树(多选)
 * @param mc_id
 * @param dm_id
 */
function showTree_route(mc_id,dm_id){
	$(".newztreebg").hide();
	_ztreefocs+=",#"+mc_id;
	var _ztree_id="ZTREE_"+mc_id;
	var _ztree=_ztreemap[_ztree_id];
	if(_ztree==undefined||$("#"+_ztree_id).length<1){//第一次加载
		//ztree设置
		var setting = {
			view:{
				showIcon:false //不显示节点图标
			},
			check : {
				enable : true,  //全部可以选中
				chkboxType:{"Y":"ps","N":"ps"},//父子关联
				chkDisabledInherit: false
			},
			callback : {
				onCheck:function(event, treeId, treeNode){
					//console.log(treeNode.checked);
					var node_id=treeNode.id;
					var node_name=treeNode.name;
					var treeObj = $.fn.zTree.getZTreeObj(_ztree_id);
					var nodes = treeObj.getCheckedNodes(true);
					var dmarr=new Array();
					var mcarr=new Array();
					$.each(nodes,function(i,obj){
						if(!obj.isParent){
							dmarr.push(obj.id);
							mcarr.push(obj.name);
						}
					});
					$("#"+dm_id).val(dmarr.join(","));
					$("#"+mc_id).val(mcarr.join(","));
				}
			},
			data : {
				simpleData : {
					enable : true
				}
			}
		};
		var zNodes =new Array();
		//封装参数
		var params=new Object();
		//发送请求，获取数据
		$.ajax({
		    url: path+"/dict/queryRoute",
		    type: "POST",
		    data: params,
		    async:false,
		    success: function (result) {
		        var success=result.success;
		        if(success==true){
		        	var list=result.route;
		        	if(list!=undefined&&list.length>0){
		        		$.each(list,function(i,obj){
		        			var mc=obj.lxmc;
		        			var dm=obj.lxdm;
							var node = {
								id : dm,
								name : mc
							};
							zNodes.push(node);
		        		});
		        	}
		        }
		    },
		    error: function (XmlHttpRequest, textStatus, errorThrown) {
		       console("系统异常，加载菜单出现异常！");
		    }
		});
		//点击选中事件
		//初始化ztree树节点
		var _ztree_key=createZtreeKey();
		var _ztree_htm="<div id='zkbg-"+_ztree_key+"' class='newztreebg'>";
		_ztree_htm+="		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
		_ztree_htm+="		<ul id='"+_ztree_id+"' class='ztree newztree c_overflow'></ul>";
		_ztree_htm+="	</div>";
		$("zkbg-"+_ztree_key+"").remove();
		$("#"+mc_id).after(_ztree_htm);
		$.fn.zTree.init($("#"+_ztree_id), setting, zNodes);
		_ztree = $.fn.zTree.getZTreeObj(_ztree_id);
		_ztreemap[_ztree_id]=_ztree;
		//初始化已选中的节点
		initCheckedNode(_ztree,$("#"+dm_id).val());
		$("#"+_ztree_id).parent().show();
	}else{
		$("#"+_ztree_id).parent().show();
	}
}
/********************************************************************************************************
 ********************************************************************************************************
 * 加载出行方式、轨迹类型选择树(多选)
 * @param mc_id
 * @param dm_id
 */
function showTree_gjlx2(mc_id,dm_id){
	$(".newztreebg").hide();
	_ztreefocs+=",#"+mc_id;
	var _ztree_id="ZTREE_"+mc_id;
	var _ztree=_ztreemap[_ztree_id];
	if(_ztree==undefined||$("#"+_ztree_id).length<1){//第一次加载
		//ztree设置
		var setting = {
			view:{
				showIcon:false //不显示节点图标
			},
			check : {
				enable : true,  //全部可以选中
				chkboxType:{"Y":"ps","N":"ps"},//父子关联
				chkDisabledInherit: false
			},
			callback : {
				onCheck:function(event, treeId, treeNode){
					//console.log(treeNode.checked);
					var node_id=treeNode.id;
					var node_name=treeNode.name;
					var treeObj = $.fn.zTree.getZTreeObj(_ztree_id);
					var nodes = treeObj.getCheckedNodes(true);
					var dmarr=new Array();
					var mcarr=new Array();
					$.each(nodes,function(i,obj){
						if(!obj.isParent){
							dmarr.push(obj.id);
							mcarr.push(obj.name);
						}
					});
					$("#"+dm_id).val(dmarr.join(","));
					$("#"+mc_id).val(mcarr.join(","));
				}
			},
			data : {
				simpleData : {
					enable : true
				}
			}
		};
		var zNodes =new Array();
		//封装参数
		var params=new Object();
        params.fbm = "gjlx";
		//发送请求，获取数据
		$.ajax({
		    url: path+"/dict/getZdList",
		    type: "POST",
		    data: params,
		    async:false,
		    success: function (result) {
		        var success=result.success;
                if(success==true){
                    var list=result.list;
                    if(list!=undefined&&list.length>0){
                        $.each(list,function(i,obj){
                            var mc=obj.mc;
                            var fdm=obj.fdm;
                            var dm=obj.dm;
                            var level=obj.level;
                            var isopen=false;
                            if(parseInt(level)<1){
                                isopen=true;
                            }
                            var node = {
                                id : dm,
                                pId : fdm,
                                name : mc,
                                open : isopen
                            };
                            zNodes.push(node);
                        });
                    }
                }
            },
		    error: function (XmlHttpRequest, textStatus, errorThrown) {
		       console("系统异常，加载菜单出现异常！");
		    }
		});
        //点击选中事件
        //初始化ztree树节点
        var _ztree_key=createZtreeKey();
        var _ztree_htm="<div id='zkbg-"+_ztree_key+"' class='newztreebg'>";
        _ztree_htm+="		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
        _ztree_htm+="		<ul id='"+_ztree_id+"' class='ztree newztree c_overflow'></ul>";
        _ztree_htm+="	</div>";
        $("zkbg-"+_ztree_key+"").remove();
        $("#"+mc_id).after(_ztree_htm);
        $.fn.zTree.init($("#"+_ztree_id), setting, zNodes);
        _ztree = $.fn.zTree.getZTreeObj(_ztree_id);
        _ztreemap[_ztree_id]=_ztree;
        //初始化已选中的节点
        initCheckedNode(_ztree,$("#"+dm_id).val());
        $("#"+_ztree_id).parent().show();
    }else{
        $("#"+_ztree_id).parent().show();
    }
}
/********************************************************************************************************
 ********************************************************************************************************
 * 加载人员类别选择树(多选)
 * @param mc_id
 * @param dm_id
 */
function showTree_rylb(mc_id,dm_id){
	$(".newztreebg").hide();
	_ztreefocs+=",#"+mc_id;
	var _ztree_id="ZTREE_"+mc_id;
	var _ztree=_ztreemap[_ztree_id];
	if(_ztree==undefined||$("#"+_ztree_id).length<1){//第一次加载
		//ztree设置
		var setting = {
			view:{
				showIcon:false //不显示节点图标
			},
			check : {
				enable : true,  //全部可以选中
				chkboxType:{"Y":"ps","N":"ps"},//父子关联
				chkDisabledInherit: false
			},
			callback : {
				onCheck:function(event, treeId, treeNode){
					//console.log(treeNode.checked);
					var node_id=treeNode.id;
					var node_name=treeNode.name;
					var treeObj = $.fn.zTree.getZTreeObj(_ztree_id);
					var nodes = treeObj.getCheckedNodes(true);
					var dmarr=new Array();
					var mcarr=new Array();
					$.each(nodes,function(i,obj){
						if(!obj.isParent){
							dmarr.push(obj.id);
							mcarr.push(obj.name);
						}
					});
					$("#"+dm_id).val(dmarr.join(","));
					$("#"+mc_id).val(mcarr.join(","));
				}
			},
			data : {
				simpleData : {
					enable : true
				}
			}
		};
		var zNodes =new Array();
		//封装参数
		var params=new Object();
		//发送请求，获取数据
		$.ajax({
		    url: path+"/dict/listRylb",
		    type: "POST",
		    data: params,
		    async:false,
		    success: function (result) {
		        var success=result.success;
		        if(success==true){
		        	var list=result.content;
		        	var node = {
							id : "rylb",
							pId : "",
							name : "全选",
							open : true
					};
		        	zNodes.push(node);
		        	if(list!=undefined&&list.length>0){
		        		$.each(list,function(i,obj){
		        			var mc=obj.codename;
		        			var dm=obj.codeid;
		        			var fbm=obj.fbm;
		        			var isopen=true;
							var node = {
								id : dm,
								name : mc,
								pId : fbm,
								open : isopen
							};
							zNodes.push(node);
		        		});
		        	}
		        }
		    },
		    error: function (XmlHttpRequest, textStatus, errorThrown) {
		       console("系统异常，加载菜单出现异常！");
		    }
		});
		//点击选中事件
		//初始化ztree树节点
		var _ztree_key=createZtreeKey();
		var _ztree_htm="<div id='zkbg-"+_ztree_key+"' class='newztreebg'>";
		_ztree_htm+="		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
		_ztree_htm+="		<ul id='"+_ztree_id+"' class='ztree newztree c_overflow'></ul>";
		_ztree_htm+="	</div>";
		$("zkbg-"+_ztree_key+"").remove();
		$("#"+mc_id).after(_ztree_htm);
		$.fn.zTree.init($("#"+_ztree_id), setting, zNodes);
		_ztree = $.fn.zTree.getZTreeObj(_ztree_id);
		_ztreemap[_ztree_id]=_ztree;
		//初始化已选中的节点
		initCheckedNode(_ztree,$("#"+dm_id).val());
		$("#"+_ztree_id).parent().show();
	}else{
		$("#"+_ztree_id).parent().show();
	}
}
/********************************************************************************************************
 ********************************************************************************************************
 * 加载省市区县选择树(多选/通用:包含省、市、区县)
 * @param mc_id
 * @param dm_id
 */
function showTree_ssqx(mc_id,dm_id){
	$(".newztreebg").hide();
	_ztreefocs+=",#"+mc_id;
	var _ztree_id="ZTREE_"+mc_id;
	var _ztree=_ztreemap[_ztree_id];
	if(_ztree==undefined||$("#"+_ztree_id).length<1){//第一次加载
		//ztree设置
		var setting = {
			view:{
				showIcon:false //不显示节点图标
			},
			check : {
				enable : true,  //全部可以选中
				chkboxType:{"Y":"ps","N":"ps"},//父子关联
				chkDisabledInherit: false
			},
			callback : {
				onCheck:function(event, treeId, treeNode){
					//console.log(treeNode.checked);
					var node_id=treeNode.id;
					var node_name=treeNode.name;
					var treeObj = $.fn.zTree.getZTreeObj(_ztree_id);
					var nodes = treeObj.getCheckedNodes(true);
					var dmarr=new Array();
					var mcarr=new Array();
					$.each(nodes,function(i,obj){
//						if(!obj.isParent){
							dmarr.push(obj.id);
							mcarr.push(obj.name);
//						}
					});
					$("#"+dm_id).val(dmarr.join(","));
					$("#"+mc_id).val(mcarr.join(","));
				}
			},
			data : {
				simpleData : {
					enable : true
				}
			}
		};
		var zNodes =new Array();
		//封装参数
		var params=new Object();
		//发送请求，获取数据
		$.ajax({
		    url: path+"/dict/getXzqhSsqxZdList",
		    type: "POST",
		    data: params,
		    async:false,
		    success: function (result) {
		        var success=result.success;
		        if(success==true){
		        	var list=result.list;
		        	if(list!=undefined&&list.length>0){
		        		$.each(list,function(i,obj){
		        			var mc=obj.mc;
		        			var fdm=obj.fdm;
		        			var dm=obj.dm;
		        			var level=obj.level;
		        			var isopen=false;
		        			if(parseInt(level)<1){
		        				isopen=true;
		        			}
							var node = {
								id : dm,
								pId : fdm,
								name : mc,
								open : isopen
							};
							zNodes.push(node);
		        		});
		        	}
		        }
		    },
		    error: function (XmlHttpRequest, textStatus, errorThrown) {
		       console("系统异常，加载菜单出现异常！");
		    }
		});
		//点击选中事件
		//初始化ztree树节点
		var _ztree_key=createZtreeKey();
		var _ztree_htm="<div id='zkbg-"+_ztree_key+"' class='newztreebg'>";
		_ztree_htm+="		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
		_ztree_htm+="		<ul id='"+_ztree_id+"' class='ztree newztree c_overflow'></ul>";
		_ztree_htm+="	</div>";
		$("zkbg-"+_ztree_key+"").remove();
		$("#"+mc_id).after(_ztree_htm);
		$.fn.zTree.init($("#"+_ztree_id), setting, zNodes);
		_ztree = $.fn.zTree.getZTreeObj(_ztree_id);
		_ztreemap[_ztree_id]=_ztree;
		//初始化已选中的节点
		initCheckedNode(_ztree,$("#"+dm_id).val());
		$("#"+_ztree_id).parent().show();
	}else{
		$("#"+_ztree_id).parent().show();
	}
}


/********************************************************************************************************
 ********************************************************************************************************
 * 加载省市区县选择树(多选/通用)
 * @param mc_id
 * @param dm_id
 */
function showTree_sf(mc_id,dm_id){
	$(".newztreebg").hide();
	_ztreefocs+=",#"+mc_id;
	var _ztree_id="ZTREE_"+mc_id;
	var _ztree=_ztreemap[_ztree_id];
	if(_ztree==undefined||$("#"+_ztree_id).length<1){//第一次加载
		//ztree设置
		var setting = {
			view:{
				showIcon:false //不显示节点图标
			},
			check : {
				enable : true,  //全部可以选中
				chkboxType:{"Y":"ps","N":"ps"},//父子关联
				chkDisabledInherit: false
			},
			callback : {
				onCheck:function(event, treeId, treeNode){
					//console.log(treeNode.checked);
					var node_id=treeNode.id;
					var node_name=treeNode.name;
					var treeObj = $.fn.zTree.getZTreeObj(_ztree_id);
					var nodes = treeObj.getCheckedNodes(true);
					var dmarr=new Array();
					var mcarr=new Array();
					$.each(nodes,function(i,obj){
						if(!obj.isParent){
							dmarr.push(obj.id);
							mcarr.push(obj.name);
						}
					});
					$("#"+dm_id).val(dmarr.join(","));
					$("#"+mc_id).val(mcarr.join(","));
				}
			},
			data : {
				simpleData : {
					enable : true
				}
			}
		};
		var zNodes =new Array();
		//封装参数
		var params=new Object();
		//发送请求，获取数据
		$.ajax({
		    url: path+"/dict/getXzqhSfZdList",
		    type: "POST",
		    data: params,
		    async:false,
		    success: function (result) {
		        var success=result.success;
		        if(success==true){
		        	var list=result.list;
		        	if(list!=undefined&&list.length>0){
		        		var firstnode = {
								id : "1000",
								pId : "000000",
								name : "中国",
								open : false
						};
		        		zNodes.push(firstnode);
		        		$.each(list,function(i,obj){
		        			var mc=obj.mc;
		        			var fdm=obj.fdm;
		        			var dm=obj.dm;
		        			var level=obj.level;
		        			var isopen=false;
		        			if(parseInt(level)<1){
		        				isopen=true;
		        			}
							var node = {
								id : dm,
								pId : fdm,
								name : mc,
								open : isopen
							};
							zNodes.push(node);
		        		});
		        	}
		        }
		    },
		    error: function (XmlHttpRequest, textStatus, errorThrown) {
		       console("系统异常，加载菜单出现异常！");
		    }
		});
		//点击选中事件
		//初始化ztree树节点
		var _ztree_key=createZtreeKey();
		var _ztree_htm="<div id='zkbg-"+_ztree_key+"' class='newztreebg'>";
		_ztree_htm+="		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
		_ztree_htm+="		<ul id='"+_ztree_id+"' class='ztree newztree c_overflow'></ul>";
		_ztree_htm+="	</div>";
		$("zkbg-"+_ztree_key+"").remove();
		$("#"+mc_id).after(_ztree_htm);
		$.fn.zTree.init($("#"+_ztree_id), setting, zNodes);
		_ztree = $.fn.zTree.getZTreeObj(_ztree_id);
		_ztreemap[_ztree_id]=_ztree;
		//初始化已选中的节点
		initCheckedNode(_ztree,$("#"+dm_id).val());
		$("#"+_ztree_id).parent().show();
	}else{
		$("#"+_ztree_id).parent().show();
	}
}
/********************************************************************************************************
 ********************************************************************************************************
 * 加载省市选择树(多选/通用:包含省、市)
 * @param mc_id
 * @param dm_id
 */
function showTree_sfds(mc_id,dm_id){
	$(".newztreebg").hide();
	_ztreefocs+=",#"+mc_id;
	var _ztree_id="ZTREE_"+mc_id;
	var _ztree=_ztreemap[_ztree_id];
	if(_ztree==undefined||$("#"+_ztree_id).length<1){//第一次加载
		//ztree设置
		var setting = {
			view:{
				showIcon:false //不显示节点图标
			},
			check : {
				enable : true,  //全部可以选中
				chkboxType:{"Y":"ps","N":"ps"},//父子关联
				chkDisabledInherit: false
			},
			callback : {
				onCheck:function(event, treeId, treeNode){
					//console.log(treeNode.checked);
					var node_id=treeNode.id;
					var node_name=treeNode.name;
					var treeObj = $.fn.zTree.getZTreeObj(_ztree_id);
					var nodes = treeObj.getCheckedNodes(true);
					var dmarr=new Array();
					var mcarr=new Array();
					$.each(nodes,function(i,obj){
						if(!obj.isParent){
							dmarr.push(obj.id);
							mcarr.push(obj.name);
						}
					});
					$("#"+dm_id).val(dmarr.join(","));
					$("#"+mc_id).val(mcarr.join(","));
				}
			},
			data : {
				simpleData : {
					enable : true
				}
			}
		};
		var zNodes =new Array();
		//封装参数
		var params=new Object();
		//发送请求，获取数据
		$.ajax({
		    url: path+"/dict/getXzqhSfDsZdList",
		    type: "POST",
		    data: params,
		    async:false,
		    success: function (result) {
		        var success=result.success;
		        if(success==true){
		        	var list=result.list;
		        	if(list!=undefined&&list.length>0){
		        		var firstnode = {
								id : "1000",
								pId : "000000",
								name : "中国",
								open : false
						};
		        		zNodes.push(firstnode);
		        		$.each(list,function(i,obj){
		        			var mc=obj.mc;
		        			var fdm=obj.fdm;
		        			var dm=obj.dm;
		        			var level=obj.level;
		        			var isopen=false;
		        			if(parseInt(level)<1){
		        				isopen=true;
		        			}
							var node = {
								id : dm,
								pId : fdm,
								name : mc,
								open : isopen
							};
							zNodes.push(node);
		        		});
		        	}
		        }
		    },
		    error: function (XmlHttpRequest, textStatus, errorThrown) {
		       console("系统异常，加载菜单出现异常！");
		    }
		});
		//点击选中事件
		//初始化ztree树节点
		var _ztree_key=createZtreeKey();
		var _ztree_htm="<div id='zkbg-"+_ztree_key+"' class='newztreebg'>";
		_ztree_htm+="		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
		_ztree_htm+="		<ul id='"+_ztree_id+"' class='ztree newztree c_overflow'></ul>";
		_ztree_htm+="	</div>";
		$("zkbg-"+_ztree_key+"").remove();
		$("#"+mc_id).after(_ztree_htm);
		$.fn.zTree.init($("#"+_ztree_id), setting, zNodes);
		_ztree = $.fn.zTree.getZTreeObj(_ztree_id);
		_ztreemap[_ztree_id]=_ztree;
		//初始化已选中的节点
		initCheckedNode(_ztree,$("#"+dm_id).val());
		$("#"+_ztree_id).parent().show();
	}else{
		$("#"+_ztree_id).parent().show();
	}
}


/***
 * 加载交通站点选择树(多选/通用)
 * @param mc_id
 * @param dm_id
 */
function showTree_jtzd(mc_id,dm_id){
	$(".newztreebg").hide();
	_ztreefocs+=",#"+mc_id;
	var _ztree_id="ZTREE_"+mc_id;
	var _ztree=_ztreemap[_ztree_id];
	if(_ztree==undefined||$("#"+_ztree_id).length<1){//第一次加载
		//ztree设置
		var setting = {
			view:{
				showIcon:false //不显示节点图标
			},
			check : {
				enable : true,  //全部可以选中
				chkboxType:{"Y":"ps","N":"ps"},//父子关联
				chkDisabledInherit: false
			},
			callback : {
				onCheck:function(event, treeId, treeNode){
					//console.log(treeNode.checked);
					var node_id=treeNode.id;
					var node_name=treeNode.name;
					var treeObj = $.fn.zTree.getZTreeObj(_ztree_id);
					var nodes = treeObj.getCheckedNodes(true);
					var dmarr=new Array();
					var mcarr=new Array();
					$.each(nodes,function(i,obj){
						if(!obj.isParent){
							dmarr.push(obj.id);
							mcarr.push(obj.name);
						}
					});
					$("#"+dm_id).val(dmarr.join(","));
					$("#"+mc_id).val(mcarr.join(","));
				}
			},
			data : {
				simpleData : {
					enable : true
				}
			}
		};
		var zNodes =new Array();
		//封装参数
		var params=new Object();
		//发送请求，获取数据
		$.ajax({
		    url: path+"/dict/getJtZdList",
		    type: "POST",
		    data: params,
		    async:false,
		    success: function (result) {
		        var success=result.success;
		        if(success==true){
		        	var list=result.list;
		        	if(list!=undefined&&list.length>0){
		        		$.each(list,function(i,obj){
		        			var mc=obj.mc;
		        			var fdm=obj.fdm;
		        			var dm=obj.dm;
		        			var level=obj.level;
		        			var isopen=false;
		        			if(parseInt(level)<1){
		        				isopen=true;
		        			}
							var node = {
								id : dm,
								pId : fdm,
								name : mc,
								open : isopen
							};
							zNodes.push(node);
		        		});
		        	}
		        }
		    },
		    error: function (XmlHttpRequest, textStatus, errorThrown) {
		       console("系统异常，加载菜单出现异常！");
		    }
		});
		//点击选中事件
		//初始化ztree树节点
		var _ztree_key=createZtreeKey();
		var _ztree_htm="<div id='zkbg-"+_ztree_key+"' class='newztreebg'>";
		_ztree_htm+="		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
		_ztree_htm+="		<ul id='"+_ztree_id+"' class='ztree newztree c_overflow'></ul>";
		_ztree_htm+="	</div>";
		$("zkbg-"+_ztree_key+"").remove();
		$("#"+mc_id).after(_ztree_htm);
		$.fn.zTree.init($("#"+_ztree_id), setting, zNodes);
		_ztree = $.fn.zTree.getZTreeObj(_ztree_id);
		_ztreemap[_ztree_id]=_ztree;
		//初始化已选中的节点
		initCheckedNode(_ztree,$("#"+dm_id).val());
		$("#"+_ztree_id).parent().show();
	}else{
		$("#"+_ztree_id).parent().show();
	}
}
/********************************************************************************************************
 ********************************************************************************************************
 * 加载失轨类别选择树(多选)
 * @param mc_id
 * @param dm_id
 */
function showTree_cslb(mc_id,dm_id){
	$(".newztreebg").hide();
	_ztreefocs+=",#"+mc_id;
	var _ztree_id="ZTREE_"+mc_id;
	var _ztree=_ztreemap[_ztree_id];
	if(_ztree==undefined||$("#"+_ztree_id).length<1){//第一次加载
		//ztree设置
		var setting = {
			view:{
				showIcon:false //不显示节点图标
			},
			check : {
				enable : true,  //全部可以选中
				chkboxType:{"Y":"ps","N":"ps"},//父子关联
				chkDisabledInherit: false
			},
			callback : {
				onCheck:function(event, treeId, treeNode){
					//console.log(treeNode.checked);
					var node_id=treeNode.id;
					var node_name=treeNode.name;
					var treeObj = $.fn.zTree.getZTreeObj(_ztree_id);
					var nodes = treeObj.getCheckedNodes(true);
					var dmarr=new Array();
					var mcarr=new Array();
					$.each(nodes,function(i,obj){
						if(!obj.isParent){
							dmarr.push(obj.id);
							mcarr.push(obj.name);
						}
					});
					$("#"+dm_id).val(dmarr.join(","));
					$("#"+mc_id).val(mcarr.join(","));
				}
			},
			data : {
				simpleData : {
					enable : true
				}
			}
		};
		var zNodes =new Array();
		var params=new Object();
		params.tableId="cslb";
		$.ajax({
		    url: path+"/dict/loadDicListByTableid",
		    type: "POST",
		    data: params,
		    async:false,
		    success: function (result) {
		        var success=result.success;
		        if(success==true){
		        	var list=result.content;
		        	if(list!=undefined&&list.length>0){
		        		$.each(list,function(i,obj){
		        			var mc=obj.selfname;
		        			var dm=obj.selfid;
		        			var pId=obj.parentid;
							var node = {
								id : dm,
								name : mc,
								pId:pId
							};
							zNodes.push(node);
		        		});
		        	}
		        }
		    },
		    error: function (XmlHttpRequest, textStatus, errorThrown) {
		       console("系统异常，加载菜单出现异常！");
		    }
		});
		//点击选中事件
		//初始化ztree树节点
		var _ztree_key=createZtreeKey();
		var _ztree_htm="<div id='zkbg-"+_ztree_key+"' class='newztreebg'>";
		_ztree_htm+="		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
		_ztree_htm+="		<ul id='"+_ztree_id+"' class='ztree newztree c_overflow'></ul>";
		_ztree_htm+="	</div>";
		$("zkbg-"+_ztree_key+"").remove();
		$("#"+mc_id).after(_ztree_htm);
		$.fn.zTree.init($("#"+_ztree_id), setting, zNodes);
		_ztree = $.fn.zTree.getZTreeObj(_ztree_id);
		_ztreemap[_ztree_id]=_ztree;
		//初始化已选中的节点
		initCheckedNode(_ztree,$("#"+dm_id).val());

		$("#"+_ztree_id).parent().show();
	}else{
		$("#"+_ztree_id).parent().show();
	}
}
/********************************************************************************************************
 ********************************************************************************************************
 * 加载民族选择树(多选)
 * @param mc_id
 * @param dm_id
 */
function showTree_mz(mc_id,dm_id){
	$(".newztreebg").hide();
	_ztreefocs+=",#"+mc_id;
	var _ztree_id="ZTREE_"+mc_id;
	var _ztree=_ztreemap[_ztree_id];
	if(_ztree==undefined||$("#"+_ztree_id).length<1){//第一次加载
		//ztree设置
		var setting = {
			view:{
				showIcon:false //不显示节点图标
			},
			check : {
				enable : true,  //全部可以选中
				chkboxType:{"Y":"ps","N":"ps"},//父子关联
				chkDisabledInherit: false
			},
			callback : {
				onCheck:function(event, treeId, treeNode){
					//console.log(treeNode.checked);
					var node_id=treeNode.id;
					var node_name=treeNode.name;
					var treeObj = $.fn.zTree.getZTreeObj(_ztree_id);
					var nodes = treeObj.getCheckedNodes(true);
					var dmarr=new Array();
					var mcarr=new Array();
					$.each(nodes,function(i,obj){
						if(!obj.isParent){
							dmarr.push(obj.id);
							mcarr.push(obj.name);
						}
					});
					$("#"+dm_id).val(dmarr.join(","));
					$("#"+mc_id).val(mcarr.join(","));
				}
			},
			data : {
				simpleData : {
					enable : true
				}
			}
		};
		var zNodes =new Array();
		var params=new Object();
		$.ajax({
		    url: path+"/dict/queryMzList",
		    type: "POST",
		    data: params,
		    async:false,
		    success: function (result) {
		        var success=result.success;
		        if(success==true){
		        	var list=result.content;
		        	if(list!=undefined&&list.length>0){
		        		$.each(list,function(i,obj){
		        			var mc=obj.selfname;
		        			var dm=obj.selfid;
		        			var pId=obj.parentid;
							var node = {
								id : dm,
								name : mc,
								pId:pId,
								open : true
							};
							zNodes.push(node);
		        		});
		        	}
		        }
		    },
		    error: function (XmlHttpRequest, textStatus, errorThrown) {
		       console("系统异常，加载菜单出现异常！");
		    }
		});
		//点击选中事件
		//初始化ztree树节点
		var _ztree_key=createZtreeKey();
		var _ztree_htm="<div id='zkbg-"+_ztree_key+"' class='newztreebg'>";
		_ztree_htm+="		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
		_ztree_htm+="		<ul id='"+_ztree_id+"' class='ztree newztree c_overflow'></ul>";
		_ztree_htm+="	</div>";
		$("zkbg-"+_ztree_key+"").remove();
		$("#"+mc_id).after(_ztree_htm);
		$.fn.zTree.init($("#"+_ztree_id), setting, zNodes);
		_ztree = $.fn.zTree.getZTreeObj(_ztree_id);
		_ztreemap[_ztree_id]=_ztree;
		//初始化已选中的节点
		initCheckedNode(_ztree,$("#"+dm_id).val());
		$("#"+_ztree_id).parent().show();
	}else{
		$("#"+_ztree_id).parent().show();
	}
}
/********************************************************************************************************
 ********************************************************************************************************
 * 加载用户所属省份公安部选择树(多选)
 * @param mc_id
 * @param dm_id
 */
function showTree_xfdw(mc_id,dm_id,flag){
	$(".newztreebg").hide();
	_ztreefocs+=",#"+mc_id;
	var _ztree_id="ZTREE_"+mc_id;
	var _ztree=_ztreemap[_ztree_id];
	if(_ztree==undefined || flag){//第一次加载
		//ztree设置
		var setting = {
			view:{
				showIcon:false //不显示节点图标
			},
			check : {
				enable : true,  //全部可以选中
				chkboxType:{"Y":"ps","N":"ps"},//父子关联
				chkDisabledInherit: false
			},
			callback : {
				onCheck:function(event, treeId, treeNode){
					//console.log(treeNode.checked);
					var node_id=treeNode.id;
					var node_name=treeNode.name;
					var treeObj = $.fn.zTree.getZTreeObj(_ztree_id);
					var nodes = treeObj.getCheckedNodes(true);
					var dmarr=new Array();
					var mcarr=new Array();
					$.each(nodes,function(i,obj){
						if(!obj.isParent){
							dmarr.push(obj.id);
							mcarr.push(obj.name);
						}
					});
					$("#"+dm_id).val(dmarr.join(","));
					$("#"+mc_id).val(mcarr.join(","));
				}
			},
			data : {
				simpleData : {
					enable : true
				}
			}
		};
		var zNodes =new Array();
		var params=new Object();
		$.ajax({
		    url: path+"/dict/loadHcdwList",
		    type: "POST",
		    data: params,
		    async:false,
		    success: function (result) {
		        var success=result.success;
		        if(success==true){
		        	var list=result.content;
		        	if(list!=undefined&&list.length>0){
		        		$.each(list,function(i,obj){
		        			var mc=obj.selfname;
		        			var dm=obj.selfid;
		        			var pId=obj.parentid;
							var node = {
								id : dm,
								name : mc,
								pId:pId,
								open:true
							};
							zNodes.push(node);
		        		});
		        	}
		        }
		    },
		    error: function (XmlHttpRequest, textStatus, errorThrown) {
		       console("系统异常，加载菜单出现异常！");
		    }
		});
		//点击选中事件
		//初始化ztree树节点
		var _ztree_key=createZtreeKey();
		var _ztree_htm="<div id='zkbg-"+_ztree_key+"' class='newztreebg'>";
		_ztree_htm+="		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
		_ztree_htm+="		<ul id='"+_ztree_id+"' class='ztree newztree c_overflow'></ul>";
		_ztree_htm+="	</div>";
		$("zkbg-"+_ztree_key+"").remove();
		$("#"+mc_id).after(_ztree_htm);
		$.fn.zTree.init($("#"+_ztree_id), setting, zNodes);
		_ztree = $.fn.zTree.getZTreeObj(_ztree_id);
		_ztreemap[_ztree_id]=_ztree;
		//初始化已选中的节点
		initCheckedNode(_ztree,$("#"+dm_id).val());
		$("#"+_ztree_id).parent().show();
	}else{
		$("#"+_ztree_id).parent().show();
	}
}




/***
 * 根据选中的节点代码进行处理：将地市代码中的省份代码抽取出来，统一
 */
function getZdDm(sfdsdm){
	var result="";
	if(!isNull(sfdsdm)){
		var arr=sfdsdm.split(",");
		if(arr!=undefined&&arr.length>0){
			var dmmap={};
			for(var i=0;i<arr.length;i++){
				var dm=arr[i];
				if(!isNull(dm)){
					var sfdm=dm.substring(0,2)+"0000";
					dmmap[sfdm]=sfdm;
					dmmap[dm]=dm;
				}
			}
			if(dmmap!=undefined){
				var dm_arr=new Array();
				for(var dm in dmmap){
					dm_arr.push(dm);
				}
				result=dm_arr.join(",");
			}
		}
	}
	return result;
}

/********************************************************************************************************
 ********************************************************************************************************
 * 加载户籍地选择树(多选/通用:包含省、市、区县)
 * @param mc_id
 * @param dm_id
 */
function showTree_hjd(mc_id,dm_id){
    $(".newztreebg").hide();
    _ztreefocs+=",#"+mc_id;
    var _ztree_id="ZTREE_"+mc_id;
    var _ztree=_ztreemap[_ztree_id];
    if(_ztree==undefined||$("#"+_ztree_id).length<1){//第一次加载
        //ztree设置
        var setting = {
            view:{
                showIcon:false //不显示节点图标
            },
            check : {
                enable : true,  //全部可以选中
                chkboxType:{"Y":"ps","N":"ps"},//父子关联
                chkDisabledInherit: false
            },
            callback : {
                onCheck:function(event, treeId, treeNode){
                    //console.log(treeNode.checked);
                    var node_id=treeNode.id;
                    var node_name=treeNode.name;
                    var treeObj = $.fn.zTree.getZTreeObj(_ztree_id);
                    var nodes = treeObj.getCheckedNodes(true);
                    var dmarr=new Array();
                    var mcarr=new Array();
                    $.each(nodes,function(i,obj){
                        if(!obj.isParent){
                            dmarr.push(obj.id);
                            mcarr.push(obj.name);
                        }
                    });
                    $("#"+dm_id).val(dmarr.join(","));
                    $("#"+mc_id).val(mcarr.join(","));
                }
            },
            data : {
                simpleData : {
                    enable : true
                }
            }
        };
        var zNodes =new Array();
        //封装参数
        var params=new Object();
        //发送请求，获取数据
        $.ajax({
            url:"/dict/getXzqhHjdZdList",
            type: "GET",
            data: params,
            async:false,
            success: function (result) {
                var success=result.success;
                if(success==true){
                    var list=result.list;
                    if(list!=undefined&&list.length>0){
                        $.each(list,function(i,obj){
                            var mc=obj.mc;
                            var fdm=obj.fdm;
                            var dm=obj.dm;
                            var level=obj.level;
                            var isopen=false;
                            if(parseInt(level)<1){
                                isopen=true;
                            }
                            var node = {
                                id : dm,
                                pId : fdm,
                                name : mc,
                                open : isopen
                            };
                            zNodes.push(node);
                        });
                    }
                }
            },
            error: function (XmlHttpRequest, textStatus, errorThrown) {
                console.log("系统异常，加载菜单出现异常！");
            }
        });
        //点击选中事件
        //初始化ztree树节点
        var _ztree_key=createZtreeKey();
        var _ztree_htm="<div id='zkbg-"+_ztree_key+"' class='newztreebg'>";
        _ztree_htm+="		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
        _ztree_htm+="		<ul id='"+_ztree_id+"' class='ztree newztree c_overflow'></ul>";
        _ztree_htm+="	</div>";
        $("zkbg-"+_ztree_key+"").remove();
        $("#"+mc_id).after(_ztree_htm);
        $.fn.zTree.init($("#"+_ztree_id), setting, zNodes);
        _ztree = $.fn.zTree.getZTreeObj(_ztree_id);
        _ztreemap[_ztree_id]=_ztree;
        //初始化已选中的节点
        initCheckedNode(_ztree,$("#"+dm_id).val());
        $("#"+_ztree_id).parent().show();
    }else{
        $("#"+_ztree_id).parent().show();
    }

}


    /********************************************************************************************************
     ********************************************************************************************************
     * 加载选择树(多选)
     * @param mc_id
     * @param dm_id
     */

    function showTree_gjlx(mc_id,dm_id){
        $(".newztreebg").hide();
        _ztreefocs+=",#"+mc_id;
        var _ztree_id="ZTREE_"+mc_id;
        var _ztree=_ztreemap[_ztree_id];
        if(_ztree==undefined||$("#"+_ztree_id).length<1){//第一次加载
            //ztree设置
            var setting = {
                view:{
                    showIcon:false //不显示节点图标
                },
                check : {
                    enable : true,  //全部可以选中
                    chkboxType:{"Y":"ps","N":"ps"},//父子关联
                    chkDisabledInherit: false
                },
                callback : {
                    onCheck:function(event, treeId, treeNode){
                        //console.log(treeNode.checked);
                        var node_id=treeNode.id;
                        var node_name=treeNode.name;
                        var treeObj = $.fn.zTree.getZTreeObj(_ztree_id);
                        var nodes = treeObj.getCheckedNodes(true);
                        var dmarr=new Array();
                        var mcarr=new Array();
                        $.each(nodes,function(i,obj){
                            if(!obj.isParent){
                                dmarr.push(obj.id);
                                mcarr.push(obj.name);
                            }
                        });
                        $("#"+dm_id).val(dmarr.join(","));
                        $("#"+mc_id).val(mcarr.join(","));
                    }
                },
                data : {
                    simpleData : {
                        enable : true
                    }
                }
            };
            var zNodes =new Array();
            //封装参数
            var params=new Object();
            params.fbm = "gjlx";
            //发送请求，获取数据
            $.ajax({
                url:"/dict/getZdList",
                type: "GET",
                data: params,
                async:false,
                success: function (result) {
                    var success=result.success;
                    if(success==true){
                        var list=result.list;
                        if(list!=undefined&&list.length>0){
                            var node = {
                                id :"gjlx",
                                pId : "",
                                name : "全选",
                                open : true
                            };
                            zNodes.push(node);
                            $.each(list,function(i,obj){
                                var mc=obj.mc;
                                var fdm=obj.fbm;
                                var dm=obj.bm;
                                var level=obj.level;
                                var isopen=false;
                                if(parseInt(level)<1){
                                    isopen=true;
                                }
                                var node = {
                                    id : dm,
                                    pId : fdm,
                                    name : mc,
                                    open : isopen
                                };
                                zNodes.push(node);
                            });
                        }
                    }
                },
                error: function (XmlHttpRequest, textStatus, errorThrown) {
                    console.log("系统异常，加载菜单出现异常！");
                }
            });
            //点击选中事件
            //初始化ztree树节点
            var _ztree_key=createZtreeKey();
            var _ztree_htm="<div id='zkbg-"+_ztree_key+"' class='newztreebg'>";
            _ztree_htm+="		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
            _ztree_htm+="		<ul id='"+_ztree_id+"' class='ztree newztree c_overflow'></ul>";
            _ztree_htm+="	</div>";
            $("zkbg-"+_ztree_key+"").remove();
            $("#"+mc_id).after(_ztree_htm);
            $.fn.zTree.init($("#"+_ztree_id), setting, zNodes);
            _ztree = $.fn.zTree.getZTreeObj(_ztree_id);
            _ztreemap[_ztree_id]=_ztree;
            //初始化已选中的节点
            initCheckedNode(_ztree,$("#"+dm_id).val());
            $("#"+_ztree_id).parent().show();
        }else{
            $("#"+_ztree_id).parent().show();
        }
    }
function showTree_gjlx_sx(mc_id,dm_id){
    $(".newztreebg").hide();
    _ztreefocs+=",#"+mc_id;
    var _ztree_id="ZTREE_"+mc_id;
    var _ztree=_ztreemap[_ztree_id];
    if(_ztree==undefined||$("#"+_ztree_id).length<1){//第一次加载
        //ztree设置
        var setting = {
            view:{
                showIcon:false //不显示节点图标
            },
            check : {
                enable : true,  //全部可以选中
                chkboxType:{"Y":"ps","N":"ps"},//父子关联
                chkDisabledInherit: false
            },
            callback : {
                onCheck:function(event, treeId, treeNode){
                    //console.log(treeNode.checked);
                    var node_id=treeNode.id;
                    var node_name=treeNode.name;
                    var treeObj = $.fn.zTree.getZTreeObj(_ztree_id);
                    var nodes = treeObj.getCheckedNodes(true);
                    var dmarr=new Array();
                    var mcarr=new Array();
                    $.each(nodes,function(i,obj){
                        if(!obj.isParent){
                            dmarr.push(obj.id);
                            mcarr.push(obj.name);
                        }
                    });
                    $("#"+dm_id).val(dmarr.join(","));
                    $("#"+mc_id).val(mcarr.join(","));
                }
            },
            data : {
                simpleData : {
                    enable : true
                }
            }
        };
        var zNodes =new Array();
        //封装参数
        var params=new Object();
        //发送请求，获取数据
        $.ajax({
            url:"/dict/getGjlxSxList",
            type: "GET",
            data: params,
            async:false,
            success: function (result) {
                var success=result.success;
                if(success==true){
                    var list=result.list;
                    if(list!=undefined&&list.length>0){
                        var node = {
                            id :"gjlx",
                            pId : "",
                            name : "全选",
                            open : true
                        };
                        zNodes.push(node);
                        $.each(list,function(i,obj){
                            var mc=obj.mc;
                            var fdm=obj.fbm;
                            var dm=obj.bm;
                            var level=obj.level;
                            var isopen=false;
                            if(parseInt(level)<1){
                                isopen=true;
                            }
                            var node = {
                                id : dm,
                                pId : fdm,
                                name : mc,
                                open : isopen
                            };
                            zNodes.push(node);
                        });
                    }
                }
            },
            error: function (XmlHttpRequest, textStatus, errorThrown) {
                console.log("系统异常，加载菜单出现异常！");
            }
        });
        //点击选中事件
        //初始化ztree树节点
        var _ztree_key=createZtreeKey();
        var _ztree_htm="<div id='zkbg-"+_ztree_key+"' class='newztreebg'>";
        _ztree_htm+="		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
        _ztree_htm+="		<ul id='"+_ztree_id+"' class='ztree newztree c_overflow'></ul>";
        _ztree_htm+="	</div>";
        $("zkbg-"+_ztree_key+"").remove();
        $("#"+mc_id).after(_ztree_htm);
        $.fn.zTree.init($("#"+_ztree_id), setting, zNodes);
        _ztree = $.fn.zTree.getZTreeObj(_ztree_id);
        _ztreemap[_ztree_id]=_ztree;
        //初始化已选中的节点
        initCheckedNode(_ztree,$("#"+dm_id).val());
        $("#"+_ztree_id).parent().show();
    }else{
        $("#"+_ztree_id).parent().show();
    }
}


function showTree_cxlx(mc_id,dm_id){
        $(".newztreebg").hide();
        _ztreefocs+=",#"+mc_id;
        var _ztree_id="ZTREE_"+mc_id;
        var _ztree=_ztreemap[_ztree_id];
        if(_ztree==undefined||$("#"+_ztree_id).length<1){//第一次加载
            //ztree设置
            var setting = {
                view:{
                    showIcon:false //不显示节点图标
                },
                check : {
                    enable : true,  //全部可以选中
                    chkboxType:{"Y":"ps","N":"ps"},//父子关联
                    chkDisabledInherit: false
                },
                callback : {
                    onCheck:function(event, treeId, treeNode){
                        //console.log(treeNode.checked);
                        var node_id=treeNode.id;
                        var node_name=treeNode.name;
                        var treeObj = $.fn.zTree.getZTreeObj(_ztree_id);
                        var nodes = treeObj.getCheckedNodes(true);
                        var dmarr=new Array();
                        var mcarr=new Array();
                        $.each(nodes,function(i,obj){
                            if(!obj.isParent){
                                dmarr.push(obj.id);
                                mcarr.push(obj.name);
                            }
                        });
                        $("#"+dm_id).val(dmarr.join(","));
                        $("#"+mc_id).val(mcarr.join(","));
                    }
                },
                data : {
                    simpleData : {
                        enable : true
                    }
                }
            };
            var zNodes =new Array();
        //封装参数
        var params=new Object();
        params.fbm = "route";
        //发送请求，获取数据
        $.ajax({
            url:"/dict/getZdList",
            type: "GET",
            data: params,
            async:false,
            success: function (result) {
                var success=result.success;
                if(success==true){
                    var list=result.list;
                    if(list!=undefined&&list.length>0){
                        var node = {
                            id :"route",
                            pId : "route",
                            name : "全选",
                            open : true
                        };
                        zNodes.push(node);
                        $.each(list,function(i,obj){
                            var mc=obj.mc;
                            var fdm=obj.fbm;
                            var dm=obj.bm;
                            var level=obj.level;
                            var isopen=false;
                            if(parseInt(level)<1){
                                isopen=true;
                            }
                            var node = {
                                id : dm,
                                pId : fdm,
                                name : mc,
                                open : isopen
                            };
                            zNodes.push(node);
                        });
                    }
                }
            },
            error: function (XmlHttpRequest, textStatus, errorThrown) {
                console("系统异常，加载菜单出现异常！");
            }
        });
            //点击选中事件
            //初始化ztree树节点
            var _ztree_key=createZtreeKey();
            var _ztree_htm="<div id='zkbg-"+_ztree_key+"' class='newztreebg'>";
            _ztree_htm+="		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
            _ztree_htm+="		<ul id='"+_ztree_id+"' class='ztree newztree c_overflow'></ul>";
            _ztree_htm+="	</div>";
            $("zkbg-"+_ztree_key+"").remove();
            $("#"+mc_id).after(_ztree_htm);
            $.fn.zTree.init($("#"+_ztree_id), setting, zNodes);
            _ztree = $.fn.zTree.getZTreeObj(_ztree_id);
            _ztreemap[_ztree_id]=_ztree;
            //初始化已选中的节点
            initCheckedNode(_ztree,$("#"+dm_id).val());
            $("#"+_ztree_id).parent().show();
        }else{
            $("#"+_ztree_id).parent().show();
        }
}



/********************************   供专题库（重点人员）使用     ******************************************************
 ********************************************************************************************************
 * 人员类别Ztree
 * @param mc_id
 * @param dm_id
 */
function showTree_zdry(mc_id,dm_id){
    $(".newztreebg").hide();
    _ztreefocs+=",#"+mc_id;
    var _ztree_id="ZTREE_"+mc_id;
    var _ztree=_ztreemap[_ztree_id];
    if(_ztree==undefined||$("#"+_ztree_id).length<1){//第一次加载
        //ztree设置
        var setting = {
            view:{
                showIcon:false //不显示节点图标
            },
            check : {
                enable : true,  //全部可以选中
                chkboxType:{"Y":"ps","N":"ps"},//父子关联
                chkDisabledInherit: false
            },
            callback : {
                onCheck:function(event, treeId, treeNode){
                    var node_id=treeNode.id;
                    var node_name=treeNode.name;
                    var treeObj = $.fn.zTree.getZTreeObj(_ztree_id);
                    var nodes = treeObj.getCheckedNodes(true);
                    var dmarr=new Array();
                    var mcarr=new Array();
                    $.each(nodes,function(i,obj){
                        if(!obj.isParent){
                            dmarr.push(obj.id);
                            mcarr.push(obj.name);
                        }
                    });
                    $("#"+dm_id).val(dmarr.join(","));
                    $("#"+mc_id).val(mcarr.join(","));
                }
            },
            data : {
                simpleData : {
                    enable : true
                }
            }
        };
        var zNodes =new Array();
        //封装参数
        var params=new Object();
        //发送请求，获取数据
        $.ajax({
            url:"/dict/loadZdryZdList",
            type: "GET",
            data: {
            	param:JSON.stringify(params)
            },
            async:false,
            dataType:'json',
            success: function (result) {
                var success=result.success;
                if(success==true){
                    var list=result.list;
                    if(list!=undefined&&list.length>0){
                        var node = {
                            id : "zdry",
                            pId : "",
                            name : "全选",
                            open : true
                        };
                        zNodes.push(node);
                        $.each(list,function(i,obj){
                            var mc=obj.mc;
                            var fdm=obj.fbm;
                            var dm=obj.dm;
                            var level=obj.level;
                            var isopen=false;
                            if(parseInt(level)<1){
                                isopen=true;
                            }
                            var node = {
                                id : dm,
                                pId : "zdry",
                                name : mc,
                                open : isopen
                            };
                            zNodes.push(node);
                        });
                    }
                }
            },
            error: function (XmlHttpRequest, textStatus, errorThrown) {
                console.log("系统异常，加载菜单出现异常！");
            }
        });
        //点击选中事件
        //初始化ztree树节点
        var _ztree_key=createZtreeKey();
        var _ztree_htm="<div id='zkbg-"+_ztree_key+"' class='newztreebg'>";
        _ztree_htm+="		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
        _ztree_htm+="		<ul id='"+_ztree_id+"' class='ztree newztree c_overflow'></ul>";
        _ztree_htm+="	</div>";
        $("zkbg-"+_ztree_key+"").remove();
        $("#"+mc_id).after(_ztree_htm);
        $.fn.zTree.init($("#"+_ztree_id), setting, zNodes);
        _ztree = $.fn.zTree.getZTreeObj(_ztree_id);
        _ztreemap[_ztree_id]=_ztree;
        //初始化已选中的节点
        initCheckedNode(_ztree,$("#"+dm_id).val());
        $("#"+_ztree_id).parent().show();
    }else{
        $("#"+_ztree_id).parent().show();
    }
}



/**
 * 加载人员分类（排好序的）
 */
function showTree_ryfl(mc_id,dm_id){
    $(".newztreebg").hide();
    _ztreefocs+=",#"+mc_id;
    var _ztree_id="ZTREE_"+mc_id;
    var _ztree=_ztreemap[_ztree_id];
    if(_ztree==undefined || $("#"+_ztree_id).length<1){//第一次加载
        //ztree设置
        var setting = {
            view:{
                showIcon:false //不显示节点图标
            },
            check : {
                enable : true,  //全部可以选中
                chkboxType:{"Y":"ps","N":"ps"},//父子关联
                chkDisabledInherit: false
            },

            callback : {
                onCheck:function(event, treeId, treeNode){
                    //console.log(treeNode.checked);
                    var node_id=treeNode.id;
                    var node_name=treeNode.name;
                    var treeObj = $.fn.zTree.getZTreeObj(_ztree_id);
                    var nodes = treeObj.getCheckedNodes(true);
                    var dmarr=new Array();
                    var mcarr=new Array();
                    $.each(nodes,function(i,obj){
                        if(!obj.isParent){
                            dmarr.push(obj.id);
                            mcarr.push(obj.name);
                        }
                    });
                    $("#"+dm_id).val(dmarr.join(","));
                    $("#"+mc_id).val(mcarr.join(","));
                }
            },
            data : {
                simpleData : {
                    enable : true
                }
            }
        };
        var zNodes =new Array();
        var params=new Object();
        $.ajax({
            url:"/dict/getRyflList",
            type: "GET",
            data: params,
            async:false,
            success: function (result) {
                var success=result.success;
                if(success==true){
                    var list=result.content;
                    if(list!=undefined&&list.length>0){
                        var node = {
                            id : "",
                            pId : "",
                            name : "全选",
                            open : true
                        };
                        zNodes.push(node);
                        $.each(list,function(i,obj){
                            var mc=obj.mc;
                            var bm=obj.dm;
                            var node = {
                                id : bm,
                                name : mc,
                                pId:"",
                                open:true
                            };
                            zNodes.push(node);
                        });
                    }
                }
            },
            error: function (XmlHttpRequest, textStatus, errorThrown) {
                console.log("系统异常，加载菜单出现异常！");
            }
        });
        //点击选中事件
        //初始化ztree树节点
        var _ztree_key=createZtreeKey();
        var _ztree_htm="<div id='zkbg-"+_ztree_key+"' class='newztreebg'>";
        _ztree_htm+="		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
        _ztree_htm+="		<ul id='"+_ztree_id+"' class='ztree newztree c_overflow'></ul>";
        _ztree_htm+="	</div>";
        $("zkbg-"+_ztree_key+"").remove();
        $("#"+mc_id).after(_ztree_htm);
        $.fn.zTree.init($("#"+_ztree_id), setting, zNodes);
        _ztree = $.fn.zTree.getZTreeObj(_ztree_id);
        _ztreemap[_ztree_id]=_ztree;
        //初始化已选中的节点
        // initCheckedNode(_ztree,$("#"+dm_id).val());
        $("#"+_ztree_id).parent().show();
    }else{
        $("#"+_ztree_id).parent().show();
    }
}


/**
 * 加载当前学籍状态
 */
function showTree_xjzt(mc_id,dm_id){
    $(".newztreebg").hide();
    _ztreefocs+=",#"+mc_id;
    var _ztree_id="ZTREE_"+mc_id;
    var _ztree=_ztreemap[_ztree_id];
    if(_ztree==undefined || $("#"+_ztree_id).length<1){//第一次加载
        //ztree设置
        var setting = {
            view:{
                showIcon:false //不显示节点图标
            },
            check : {
                enable : true,  //全部可以选中
                chkboxType:{"Y":"ps","N":"ps"},//父子关联
                chkDisabledInherit: false
            },

            callback : {
                onCheck:function(event, treeId, treeNode){
                    //console.log(treeNode.checked);
                    var node_id=treeNode.id;
                    var node_name=treeNode.name;
                    var treeObj = $.fn.zTree.getZTreeObj(_ztree_id);
                    var nodes = treeObj.getCheckedNodes(true);
                    var dmarr=new Array();
                    var mcarr=new Array();
                    $.each(nodes,function(i,obj){
                        if(!obj.isParent){
                            dmarr.push(obj.id);
                            mcarr.push(obj.name);
                        }
                    });
                    $("#"+dm_id).val(dmarr.join(","));
                    $("#"+mc_id).val(mcarr.join(","));
                }
            },
            data : {
                simpleData : {
                    enable : true
                }
            }
        };
        var zNodes =new Array();
        var params=new Object();
        $.ajax({
            url:"/dict/getDqxjztDic",
            type: "GET",
            data: params,
            async:false,
            success: function (result) {
                var success=result.success;
                if(success==true){
                    var list=result.content;
                    if(list!=undefined&&list.length>0){
                        var node = {
                            id : "",
                            pId : "",
                            name : "全选",
                            open : true
                        };
                        zNodes.push(node);
                        $.each(list,function(i,obj){
                            var mc=obj.mc;
                            var bm=obj.dm;
                            var node = {
                                id : bm,
                                name : mc,
                                pId:"",
                                open:true
                            };
                            zNodes.push(node);
                        });
                    }
                }
            },
            error: function (XmlHttpRequest, textStatus, errorThrown) {
                console.log("系统异常，加载菜单出现异常！");
            }
        });
        //点击选中事件
        //初始化ztree树节点
        var _ztree_key=createZtreeKey();
        var _ztree_htm="<div id='zkbg-"+_ztree_key+"' class='newztreebg'>";
        _ztree_htm+="		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
        _ztree_htm+="		<ul id='"+_ztree_id+"' class='ztree newztree c_overflow'></ul>";
        _ztree_htm+="	</div>";
        $("zkbg-"+_ztree_key+"").remove();
        $("#"+mc_id).after(_ztree_htm);
        $.fn.zTree.init($("#"+_ztree_id), setting, zNodes);
        _ztree = $.fn.zTree.getZTreeObj(_ztree_id);
        _ztreemap[_ztree_id]=_ztree;
        //初始化已选中的节点
        // initCheckedNode(_ztree,$("#"+dm_id).val());
        $("#"+_ztree_id).parent().show();
    }else{
        $("#"+_ztree_id).parent().show();
    }
}


/********************************************************************************************************
 ********************************************************************************************************
 * 加载户籍地选择树(多选/通用:包含省、市、区县)
 * @param mc_id
 * @param dm_id
 */
function showTree_SJ_hjd(mc_id,dm_id){
    $(".newztreebg").hide();
    _ztreefocs+=",#"+mc_id;
    var _ztree_id="ZTREE_"+mc_id;
    var _ztree=_ztreemap[_ztree_id];
    if(_ztree==undefined||$("#"+_ztree_id).length<1){//第一次加载
        //ztree设置
        var setting = {
            view:{
                showIcon:false //不显示节点图标
            },
            check : {
                enable : true,  //全部可以选中
                chkboxType:{"Y":"ps","N":"ps"},//父子关联
                chkDisabledInherit: false
            },
            callback : {
                onCheck:function(event, treeId, treeNode){
                    //console.log(treeNode.checked);
                    var node_id=treeNode.id;
                    var node_name=treeNode.name;
                    var treeObj = $.fn.zTree.getZTreeObj(_ztree_id);
                    var nodes = treeObj.getCheckedNodes(true);
                    var dmarr=new Array();
                    var mcarr=new Array();
                    $.each(nodes,function(i,obj){
                        if(!obj.isParent){
                            dmarr.push(obj.id);
                            mcarr.push(obj.name);
                        }
                    });
                    $("#"+dm_id).val(dmarr.join(","));
                    $("#"+mc_id).val(mcarr.join(","));
                }
            },
            data : {
                simpleData : {
                    enable : true
                }
            }
        };
        var zNodes =new Array();
        //封装参数
        var params=new Object();
        //发送请求，获取数据
        $.ajax({
            url:"/dict/getXzqhSJHjdZdList",
            type: "GET",
            data: params,
            async:false,
            success: function (result) {
                var success=result.success;
                if(success==true){
                    var list=result.list;
                    if(list!=undefined&&list.length>0){
                        $.each(list,function(i,obj){
                            var mc=obj.mc;
                            var fdm=obj.fdm;
                            var dm=obj.dm;
                            var level=obj.level;
                            var isopen=false;
                            if(parseInt(level)<1){
                                isopen=true;
                            }
                            var node = {
                                id : dm,
                                pId : fdm,
                                name : mc,
                                open : isopen
                            };
                            zNodes.push(node);
                        });
                    }
                }
            },
            error: function (XmlHttpRequest, textStatus, errorThrown) {
                console.log("系统异常，加载菜单出现异常！");
            }
        });
        //点击选中事件
        //初始化ztree树节点
        var _ztree_key=createZtreeKey();
        var _ztree_htm="<div id='zkbg-"+_ztree_key+"' class='newztreebg'>";
        _ztree_htm+="		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
        _ztree_htm+="		<ul id='"+_ztree_id+"' class='ztree newztree c_overflow'></ul>";
        _ztree_htm+="	</div>";
        $("zkbg-"+_ztree_key+"").remove();
        $("#"+mc_id).after(_ztree_htm);
        $.fn.zTree.init($("#"+_ztree_id), setting, zNodes);
        _ztree = $.fn.zTree.getZTreeObj(_ztree_id);
        _ztreemap[_ztree_id]=_ztree;
        //初始化已选中的节点
        initCheckedNode(_ztree,$("#"+dm_id).val());
        $("#"+_ztree_id).parent().show();
    }else{
        $("#"+_ztree_id).parent().show();
    }
}

function showTree_jcmp_ZY(mc_id,dm_id){
    $(".newztreebg").hide();
    _ztreefocs+=",#"+mc_id;
    var _ztree_id="ZTREE_"+mc_id;
    var _ztree=_ztreemap[_ztree_id];
    console.log($("#"+_ztree_id).length);
    if(_ztree==undefined||$("#"+_ztree_id).length<1){//第一次加载
        //ztree设置
        var setting = {
            view:{
                showIcon:false //不显示节点图标
            },
            check : {
                enable : true,  //全部可以选中
                chkboxType:{"Y":"ps","N":"ps"},//父子关联
                chkDisabledInherit: false
            },
            callback : {
                onCheck:function(event, treeId, treeNode){
                    //console.log(treeNode.checked);
                    var node_id=treeNode.id;
                    var node_name=treeNode.name;
                    var treeObj = $.fn.zTree.getZTreeObj(_ztree_id);
                    var nodes = treeObj.getCheckedNodes(true);
                    var dmarr=new Array();
                    var mcarr=new Array();
                    $.each(nodes,function(i,obj){
                        if(obj.level>0){
                            dmarr.push(obj.id);
                            mcarr.push(obj.name);
                        }
                    });
                    $("#"+dm_id).val(dmarr.join(","));
                    $("#"+mc_id).val(mcarr.join(","));
                }
            },
            data : {
                simpleData : {
                    enable : true
                }
            }
        };
        var zNodes =new Array();
        //封装参数
        var params=new Object();
        //发送请求，获取数据
        $.ajax({
            url: path+"/jcmp/cx/queryZyDic",
            type: "POST",
            data: params,
            async:false,
            success: function (result) {
                var success=result.success;
                if(success==true){
                    var list=result.content.list;
                    var node = {
                        id : "jcmp_zy",
                        pId : "",
                        name : "全选",
                        open : true
                    };
                    zNodes.push(node);
                    if(list!=undefined&&list.length>0){
                        $.each(list,function(i,obj){
                            var mc=obj.codeName;
                            var fbm=obj.tableId;
                            var bm=obj.codeId;
                            var node = {
                                id : bm,
                                pId : fbm,
                                name : mc,
                                open : true
                            };
                            zNodes.push(node);
                        });
                     }
                }
            },
            error: function (XmlHttpRequest, textStatus, errorThrown) {
                console.log("系统异常，加载职业菜单出现异常！");
            }
        });
        //点击选中事件
        //初始化ztree树节点
        var _ztree_key=createZtreeKey();
        var _ztree_htm="<div id='zkbg-"+_ztree_key+"' class='newztreebg'>";
        _ztree_htm+="		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
        _ztree_htm+="		<ul id='"+_ztree_id+"' class='ztree newztree c_overflow'></ul>";
        _ztree_htm+="	</div>";
        $("zkbg-"+_ztree_key+"").remove();
        $("#"+mc_id).after(_ztree_htm);
        $.fn.zTree.init($("#"+_ztree_id), setting, zNodes);
        _ztree = $.fn.zTree.getZTreeObj(_ztree_id);
        _ztreemap[_ztree_id]=_ztree;
        //初始化已选中的节点
        initCheckedNode(_ztree,$("#"+dm_id).val());
        $("#"+_ztree_id).parent().show();
    }else{
        $("#"+_ztree_id).parent().show();
    }
}

//重置
function resetQueryList(domObj, ztreeList){
	domObj.find("input, select").each(function(i){
		var $this = $(this), type = $this.attr("type"), id = $this.attr("id"), name = $this.attr("name"), val = $this.val();
		type == "radio" || type == "checkbox" ? $this.prop("checked", false) : $this.val("");
		if(type == "radio" && val == "0") $this.prop("checked", true);
	});
	if(ztreeList && ztreeList.length > 0){
		$.each(ztreeList, function(i, item){
			checkAllNodes(item);
		});
	}
}
function checkAllNodes(treeId){
	var ZTreeObj = $.fn.zTree.getZTreeObj(treeId);
	if(ZTreeObj) ZTreeObj.checkAllNodes(false);
}





/*
 * 转发单选
 * */
function createSingleSelectZtree(mc_id, dm_id, zNodes){
	$(".newztreebg").hide();
	_ztreefocs += ",#" + mc_id;
	var treeId = "ZTREE_" + mc_id;
	var keywordId = "key_" + mc_id;
	var panelId = "panel_" + mc_id;
	//ztree设置
	var setting = {
		view:{
			showIcon:false //不显示节点图标
		},
		check : {
			enable : true,  //全部可以选中
			chkStyle:"radio",
		},
		callback : {
			beforeClick: function(treeId, treeNode){
				var ztree = $.fn.zTree.getZTreeObj(treeId);
				return (treeNode.id != ztree.getRoot().children[0].id);
			},
			onCheck:function(event, treeId, treeNode){
				$("#" + dm_id).val(treeNode.id);
				$("#" + mc_id).val(treeNode.name);
				var ztree = $.fn.zTree.getZTreeObj(treeId);
				var nodes = ztree.getCheckedNodes(true);
				for(var k = 0; k < nodes.length; k++){
					ztree.checkNode(nodes[k], false, false);
				}
				ztree.checkNode(treeNode, true, false);
			},
			onClick:function(event, treeId, treeNode){
				$("#" + dm_id).val(treeNode.id);
				$("#" + mc_id).val(treeNode.name);
				var ztree = $.fn.zTree.getZTreeObj(treeId);
				var nodes = ztree.getCheckedNodes(true);
				for(var k = 0; k < nodes.length; k++){
					ztree.checkNode(nodes[k], false, false);
				}
				ztree.checkNode(treeNode, true, false);
			}
		},
		data : {
			simpleData : {
				enable : true
			}
		}
	};
	var ztree_htm="<div class='newztreebg' id='" + panelId + "'>";
	ztree_htm+="		<div class='newztreetit'><input type='text' id='" + keywordId + "' placeholder='请输入...' style='border:0px;background-color:#EEF0F3;width:75%' onkeyup='showFilterTree(\""+ treeId + "\",this)'/><font onclick='closeZtree(this)'>×</font></div>";
	ztree_htm+="		<ul id='" + treeId + "' class='ztree newztree c_overflow'></ul>";
	ztree_htm+="	</div>";
	$("#" + panelId).remove();
	$("#" + mc_id).after(ztree_htm);
	$.fn.zTree.init($("#" + treeId), setting, zNodes);
	$("#" + treeId).parent().show();
	$("#" + keywordId).focus();
}

function createMultipleSelectZtree(mc_id, dm_id, zNodes){
	$(".newztreebg").hide();
	_ztreefocs += ",#" + mc_id;
	var treeId = "ZTREE_" + mc_id;
	var treeObj = $.fn.zTree.getZTreeObj(treeId);
	if(treeObj && $("#" + treeId).length > 0) {
		$("#" + treeId).parent().show();
		return;
	}
	//ztree设置
	var setting = {
		view:{
			showIcon:false //不显示节点图标
		},
		check : {
			enable : true,  //全部可以选中
			chkboxType:{"Y":"s","N":"ps"},//父子关联
			chkDisabledInherit: false
		},
		callback : {
			onCheck:function(event, treeId, treeNode){
				var node_id=treeNode.id;
				var node_name=treeNode.name;
				var treeObj = $.fn.zTree.getZTreeObj(treeId);
				var nodes = treeObj.getCheckedNodes(true);
				var dmarr=new Array();
				var mcarr=new Array();
				$.each(nodes,function(i,obj){
					if(obj.check_Child_State!=1){
						dmarr.push(obj.id);
						mcarr.push(obj.name);
					}
				});
				$("#"+dm_id).val(dmarr.join(","));
				$("#"+mc_id).val(mcarr.join(","));
			}
		},
		data : {
			simpleData : {
				enable : true
			}
		}
	};
	//初始化ztree树节点
	var ztree_htm = "<div class='newztreebg'>";
	ztree_htm += "		<div class='newztreetit'>请选择 ...<font onclick='closeZtree(this)'>×</font></div>";
	ztree_htm += "		<ul id='" + treeId + "' class='ztree newztree c_overflow'></ul>";
	ztree_htm += "	</div>";
	$("#" + mc_id).after(ztree_htm);
	$.fn.zTree.init($("#" + treeId), setting, zNodes);
	$("#" + treeId).parent().show();
}

function showFilterTree(treeId, obj){
	var value = $(obj).val();
	var treeObj = $.fn.zTree.getZTreeObj(treeId, obj);
	var zNodes = baiscData.getTaskTreeList(value);
	treeObj.reLoadChildNodes(null, zNodes);
}

function checkAllNodes(treeId){
	var ZTreeObj = $.fn.zTree.getZTreeObj(treeId);
	if(ZTreeObj) ZTreeObj.checkAllNodes(false);
}



